File: run.t

package info (click to toggle)
ocaml-odoc 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,008 kB
  • sloc: ml: 60,567; javascript: 2,572; sh: 566; makefile: 31
file content (89 lines) | stat: -rw-r--r-- 2,269 bytes parent folder | download | duplicates (2)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  $ cat a.mli
  module type Y = sig
    type t = int
    val y : t
    include sig
      type nonrec t = t
      val z : t
    end with type t := t
  end
  
  module type Z = sig
    include Y
  
    type nonrec t = t
  end
  

Here we have module type Z that causes shadowing of the type `t` from the included module type Y.
The test here is for a bug that existed where the shadowed items in the `include sig ... end with ...`
were being incorrectly shadowed themselves - ie, the `include sig type nonrec t = t ... end was being
rewritten to be `include sig type nonrec {t}1/... = t .. end` which is incorrect.

  $ ocamlc -bin-annot -c a.mli
  $ odoc compile a.cmti --unique-id AAAA
  $ odoc link a.odoc

The odocl file ought to show that, within Z, the expansion of module type Y contains a shadowed
type `t`, but in the subsequent include, the type `t` within the signature _isn't_ mangled.

  $ odoc_print a.odocl --short --show-include-expansions
  module type Y = 
    sig
      type t = int
      val y : t
      include sigtype t = t
                   val z : tend with [t = t] (sig : val z : t end)
    end
  module type Z = 
    sig
      include Y
        (sig :
          type {t}1/shadowed/(AAAA) = int
          val y : int
          include sigtype t = t
                       val z : tend with [t = int] (sig : val z : int end)
         end)
      type t = int
    end
  $ odoc html-generate a.odocl -o html
  $ odoc support-files -o html


For comparison, another test case that didn't have the bug:

  $ cat b.mli
  module type X = sig
    type t
    val z : t
  end
  
  module type Y = sig
    type t = int
    val y : t
    include X with type t := t
  end
  
  module type Z = sig
    include Y
  
    type nonrec t = t
  end
  
  $ ocamlc -bin-annot -c b.mli
  $ odoc compile b.cmti --unique-id BBBB
  $ odoc link b.odoc
  $ odoc_print b.odocl --short --show-include-expansions
  module type X = sig type t val z : t end
  module type Y = 
    sig type t = int val y : t include X with [t = t] (sig : val z : t end) end
  module type Z = 
    sig
      include Y
        (sig :
          type {t}1/shadowed/(BBBB) = int
          val y : int
          include X with [t = int] (sig : val z : int end)
         end)
      type t = int
    end