@@ -7,49 +7,32 @@ class Foo(x)
7
7
//│ = [Function: Foo1]
8
8
9
9
10
- :d
11
10
if 1 is 1 then 1
12
- //│ 0. Typing term if (is (1,) (1,)) then 1
13
- //│ | Flattened conjunctions
14
- //│ | <eq (1,) (1,)> => 1
15
- //│ | The mutable CaseOf tree
16
- //│ | IfThenElse(eq (1,) (1,),Consequent(1),MissingCase)
17
- //│ /!!!\ Uncaught error: scala.NotImplementedError: an implementation is missing
18
- //│ at: scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
19
- //│ at: mlscript.MutCaseOf$MissingCase$.$anonfun$toTerm$1(helpers.scala:958)
20
- //│ at: scala.Option.getOrElse(Option.scala:201)
21
- //│ at: mlscript.MutCaseOf$MissingCase$.toTerm(helpers.scala:958)
22
- //│ at: mlscript.MutCaseOf$IfThenElse.toTerm(helpers.scala:901)
23
- //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:738)
24
- //│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:30)
25
- //│ at: mlscript.Typer.typeTerm(Typer.scala:747)
26
- //│ at: mlscript.Typer.typeStatement(Typer.scala:376)
27
- //│ at: mlscript.DiffTests.$anonfun$new$55(DiffTests.scala:558)
28
-
29
-
30
- if f is
31
- Foo(a) then a
32
- //│ ╔══[ERROR] identifier not found: f
33
- //│ ║ l.30: if f is
34
- //│ ╙── ^
11
+ //│ ╔══[ERROR] missing a default branch
12
+ //│ ║ l.10: if 1 is 1 then 1
13
+ //│ ╙── ^^^^^^^^^^^^^
35
14
//│ res: error
36
15
//│ Code generation encountered an error:
37
- //│ unresolved symbol f
16
+ //│ if expression has not been not desugared
17
+
18
+ fun test(x) = if x is 1 then 0 else 1
19
+ //│ test: number -> (0 | 1)
20
+ //│ = [Function: test]
38
21
39
22
if f is
40
23
Foo(a) then a
41
24
Foo(a) then a
42
25
//│ /!!!\ Uncaught error: scala.NotImplementedError: an implementation is missing
43
26
//│ at: scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
44
- //│ at: mlscript.MutCaseOf$Consequent.append(helpers.scala:953 )
45
- //│ at: mlscript.MutCaseOf$Match.append(helpers.scala:916 )
46
- //│ at: mlscript.MutCaseOf$.$anonfun$build$1(helpers.scala:987 )
47
- //│ at: mlscript.MutCaseOf$.$anonfun$build$1$adapted(helpers.scala:987 )
27
+ //│ at: mlscript.MutCaseOf$Consequent.append(helpers.scala:955 )
28
+ //│ at: mlscript.MutCaseOf$Match.append(helpers.scala:918 )
29
+ //│ at: mlscript.MutCaseOf$.$anonfun$build$1(helpers.scala:990 )
30
+ //│ at: mlscript.MutCaseOf$.$anonfun$build$1$adapted(helpers.scala:990 )
48
31
//│ at: scala.collection.immutable.List.foreach(List.scala:333)
49
- //│ at: mlscript.MutCaseOf$.build(helpers.scala:987 )
50
- //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:735 )
32
+ //│ at: mlscript.MutCaseOf$.build(helpers.scala:990 )
33
+ //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:736 )
51
34
//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:30)
52
- //│ at: mlscript.Typer.typeTerm(Typer.scala:747 )
35
+ //│ at: mlscript.Typer.typeTerm(Typer.scala:753 )
53
36
54
37
55
38
class Bar(y, z)
@@ -61,7 +44,7 @@ fun test(f) = if f is
61
44
Foo(a) then a
62
45
Bar(b, c) then b + c
63
46
//│ test: (Bar & {y: int, z: int} | (Foo with {x: 'x})) -> (int | 'x)
64
- //│ = [Function: test ]
47
+ //│ = [Function: test1 ]
65
48
66
49
67
50
class Pair(fst, snd)
@@ -75,15 +58,15 @@ if x is
75
58
Pair(y, 1) then x
76
59
//│ /!!!\ Uncaught error: scala.NotImplementedError: an implementation is missing
77
60
//│ at: scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
78
- //│ at: mlscript.MutCaseOf$IfThenElse.append(helpers.scala:888 )
79
- //│ at: mlscript.MutCaseOf$Match.append(helpers.scala:916 )
80
- //│ at: mlscript.MutCaseOf$.$anonfun$build$1(helpers.scala:987 )
81
- //│ at: mlscript.MutCaseOf$.$anonfun$build$1$adapted(helpers.scala:987 )
61
+ //│ at: mlscript.MutCaseOf$IfThenElse.append(helpers.scala:890 )
62
+ //│ at: mlscript.MutCaseOf$Match.append(helpers.scala:918 )
63
+ //│ at: mlscript.MutCaseOf$.$anonfun$build$1(helpers.scala:990 )
64
+ //│ at: mlscript.MutCaseOf$.$anonfun$build$1$adapted(helpers.scala:990 )
82
65
//│ at: scala.collection.immutable.List.foreach(List.scala:333)
83
- //│ at: mlscript.MutCaseOf$.build(helpers.scala:987 )
84
- //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:735 )
66
+ //│ at: mlscript.MutCaseOf$.build(helpers.scala:990 )
67
+ //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:736 )
85
68
//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:30)
86
- //│ at: mlscript.Typer.typeTerm(Typer.scala:747 )
69
+ //│ at: mlscript.Typer.typeTerm(Typer.scala:753 )
87
70
88
71
class Z()
89
72
class O()
@@ -164,18 +147,18 @@ fun foo(x, y) = if x is Z() and y is O() then 0 else 1
164
147
//│ at: scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
165
148
//│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:626)
166
149
//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:30)
167
- //│ at: mlscript.Typer.typeTerm(Typer.scala:747 )
150
+ //│ at: mlscript.Typer.typeTerm(Typer.scala:753 )
168
151
//│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:714)
169
152
//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:30)
170
- //│ at: mlscript.Typer.typeTerm(Typer.scala:747 )
171
- //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:741 )
153
+ //│ at: mlscript.Typer.typeTerm(Typer.scala:753 )
154
+ //│ at: mlscript.Typer.$anonfun$typeTerm$2(Typer.scala:742 )
172
155
//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:30)
173
- //│ at: mlscript.Typer.typeTerm(Typer.scala:747 )
156
+ //│ at: mlscript.Typer.typeTerm(Typer.scala:753 )
174
157
175
158
fun foo(x, y) = if x is
176
159
Z() and y is O() then 0 else 1
177
160
//│ ╔══[PARSE ERROR] Unexpected 'else' keyword here
178
- //│ ║ l.176 : Z() and y is O() then 0 else 1
161
+ //│ ║ l.159 : Z() and y is O() then 0 else 1
179
162
//│ ╙── ^^^^
180
163
//│ foo: (Z, O,) -> 0
181
164
//│ = [Function: foo6]
0 commit comments