File: 092_requirefunctor.sml

package info (click to toggle)
smlsharp 4.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 123,732 kB
  • sloc: ansic: 16,725; sh: 4,347; makefile: 2,191; java: 742; haskell: 493; ruby: 305; cpp: 284; pascal: 256; ml: 255; lisp: 141; asm: 97; sql: 74
file content (75 lines) | stat: -rw-r--r-- 2,004 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
_interface "092_requirefunctor.smi"
structure S = F (
  fun f x = x : int
);

(*
2011-08-30 katsu

This causes BUG at InferType.

[BUG] InferType: var not found
    raised at: ../typeinference2/main/InferTypes.sml:2079.35-2079.54
   handled at: ../typeinference2/main/InferTypes.sml:2319.49
                ../typeinference2/main/InferTypes.sml:3656.28
                ../toplevel2/main/Top.sml:766.65-766.68
                ../toplevel2/main/Top.sml:868.37
                main/SimpleMain.sml:359.53
*)

(*
2011-09-01 ohori

Fixed the above bug by allowing that a functor variable be
external.

This is rather special in that 
(1) F has a polytype with the empty set of bound type variable
(2) the first argument is a function of type {} -> {}
Both of them can be eliminated if desired.

This now produce the following static analysis bug:

datatypecompilation done
[.
  (({}^{G,B,A} -f5-> {}^{G,B,A})^{G,B}
   -f8-> ((int(t0[]) -f6-> int(t0[]))^{G,B} -f7-> unit(t7[]))^{G,B})
  ^{G,B}]expandFunTy fails
tlexp:
EXVAR(F) (fn id(5) : {} => id(5))
funTy:
({} -> {}) -> (int(t0[]) -> int(t0[])) -> unit(t7[])
funExp:
EXVAR(F)
newfunExp:
EXVAR(F)
newFunTy:
[.
  (({}^{G,B,A} -f5-> {}^{G,B,A})^{G,B}
   -f8-> ((int(t0[]) -f6-> int(t0[]))^{G,B} -f7-> unit(t7[]))^{G,B})
  ^{G,B}]

[BUG] function type is expected
    raised at: ../annotatedtypes/main/AnnotatedTypesUtils.sml:56.13-57.53
   handled at: ../staticanalysis/main/StaticAnalysis.sml:201.28
		../toplevel2/main/Top.sml:868.37
		main/SimpleMain.sml:359.53

*)

(*
2011-09-02 ohori

Refined the functor abstraction so that
1. if there is no lifted tvars, then it does not produce the first arg.
2. if there is no functor args then it does not produce the second list of
   args.
3. if there is no bound type variables then it does not produce the empty 
   polytype abstraction.
4. if there is neither the first arg nor the second arg, then it produce
   a function on unit type.

With these refinment, the above bug in staticanalysis disappears.

*)