File: test.md

package info (click to toggle)
ocaml-odoc 2.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,744 kB
  • sloc: ml: 37,049; makefile: 124; sh: 79
file content (36 lines) | stat: -rw-r--r-- 942 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
```ocaml
let simple_strengthening input =
    let p = Common.root_identifier in
    let _, sg, _ = Common.model_of_string input in
    let c = Component.Of_Lang.(signature (empty ()) sg) in
    let cp = Component.Of_Lang.(resolved_module_path (empty ()) p) in
    let c' = Strengthen.signature (`Resolved cp) c in
    let open Format in
    fprintf std_formatter "BEFORE\n======\n%!";
    fprintf std_formatter "%a\n%!" Component.Fmt.signature c;
    fprintf std_formatter "AFTER \n======\n%!";
    fprintf std_formatter "%a\n%!" Component.Fmt.signature c'
```

Simple strengthening

This tests that strengthening works. When we strengthen a signature we recursively add
type equations for all abstract types.

```ocaml
# simple_strengthening {|
  type t
  type u = t
  |} ;;
BEFORE
======
type t/0
type u/1 = local(t/0,false)
 (removed=[])
AFTER
======
type t/2 = r((root Root)).t
type u/3 = local(t/2,false)
 (removed=[])
- : unit = ()
```