File: 024_polyraise.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 (49 lines) | stat: -rw-r--r-- 1,415 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
fun f 0 x = ()

(*
2011-08-16 katsu

This causes BUG at StaticAnalysis.

[BUG] StaticAnalysis:unification fail(6)
    raised at: ../staticanalysis/main/StaticAnalysis.sml:515.28-515.53
   handled at: ../toplevel2/main/Top.sml:828.37
		main/SimpleMain.sml:269.53

This is due to a RAISE term which has a polymorphic type annotation
which is generated by MatchCompiler.

val f(0) : int(t0) -> ['a. {TAG('a), SIZE('a)} -> 'a -> unit(t7)] =
    fn $T_a(2) : int(t0) =>
       (case $T_a(2) : int(t0) : int(t0) of
          0 =>
          ['a.
           (fn {$4(4) : TAG('a), $5(5) : SIZE('a)} =>
               (fn x(1) : 'a => () : unit(t7)) : 'a -> unit(t7))
           : {TAG('a), SIZE('a)} -> 'a -> unit(t7)]
        | _ =>
          (raise
             cast({1 = EXVAR(Match : boxed(t12))} : {1: int(t0)} : exn(t10)))
          : ['a. 'a -> unit(t7)])   (* <==== type mismatch *)
       : ['a. {TAG('a), SIZE('a)} -> 'a -> unit(t7)]

*)

(*
2011-08-16 katsu

This bug may be fixed by do "compileTy" for the type annotation of RCRAISE
at RecordCompilation.  This fix has been done by changeset 5f44040ba52a.

However, due to this, TLSWITCH with multiple branches may have a polymorphic
type and StaticAnalysis need to unify POLYtys of branches. Is it OK?

*)

(*
2011-08-18 katsu

At today's meeting, we leave this polymorphic type unification as it is
for the time being, and postpone to consider this issue.

*)