33
44//│ Type: ⊤
55
6+
67fun andt(x)=x&&true
78fun k(f:Nothing->Bool)=1
89fun ap(f)=x=>f(x)
@@ -14,20 +15,88 @@ k(andt)
1415k(ap(andt))
1516//│ Type: Int
1617
17- fun id:(Int->Int)&(Bool->Bool)
18+ k(k)
19+ //│ Type: Int
20+
21+ fun idIB: (Int -> Int) & (Bool -> Bool)
1822//│ Type: ⊤
1923
20- id (1)
24+ idIB (1)
2125//│ Type: Int
2226
27+ idIB(true)
28+ //│ Type: Bool
29+
30+ idIB(if true then 1 else true)
31+ //│ Type: Bool ∨ Int
32+
33+
2334fun ap1(f)=f(1)
24- ap1(id )
35+ ap1(idIB )
2536//│ Type: Int
2637
27- ap(id )(1)
38+ ap(idIB )(1)
2839//│ Type: Int
2940
3041:todo
31- x=>id (x)
42+ x=>idIB (x)
3243//│ Type: (Int ∨ Bool) ->{⊥} ⊥
3344
45+
46+ :todo // BbML
47+ fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
48+ //│ ╔══[ERROR] General type is not allowed here.
49+ //│ ║ l.47: fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
50+ //│ ╙── ^^^
51+ //│ ╔══[ERROR] General type is not allowed here.
52+ //│ ║ l.47: fun idIIBB: ([Int, Int] -> Int) & ([Bool, Bool] -> Bool)
53+ //│ ╙── ^^^^
54+ //│ Type: ⊤
55+
56+ :todo // BbML
57+ idIIBB([1, 2])
58+ //│ ╔══[ERROR] Term shape not yet supported by BbML: Tup(List(Fld(‹›,Lit(IntLit(1)),None), Fld(‹›,Lit(IntLit(2)),None)))
59+ //│ ║ l.57: idIIBB([1, 2])
60+ //│ ╙── ^^^^^^
61+ //│ Type: ⊥
62+
63+
64+ class Pair[out A, out B](fst: A, snd: B)
65+ //│ Type: ⊤
66+
67+ new Pair(1, 2)
68+ //│ Type: Pair['A, 'B]
69+ //│ Where:
70+ //│ Int <: 'A
71+ //│ Int <: 'B
72+
73+ :todo // WF check on intersection types
74+ :e
75+ fun idIIBB: (Pair[Int, Int] -> Int) & (Pair[Bool, Bool] -> Bool)
76+ //│ Type: ⊤
77+
78+ idIIBB(new Pair(1, 2))
79+ //│ Type: Bool ∨ Int
80+
81+ idIIBB(new Pair(1, true))
82+ //│ Type: Bool ∨ Int
83+
84+
85+
86+ :todo
87+ fun foo: ["x": Int, "y": Int]
88+ //│ ╔══[ERROR] Invalid type
89+ //│ ║ l.87: fun foo: ["x": Int, "y": Int]
90+ //│ ╙── ^^^^^^^^^^^^^^^^^^^^
91+ //│ Type: ⊤
92+
93+ foo
94+ //│ Type: ⊥
95+
96+ :todo
97+ fun foo(x) = if x is
98+ [true, true] then 1
99+ [false, false] then 2
100+ //│ /!!!\ Uncaught error: scala.MatchError: Tuple(2,false) (of class hkmc2.semantics.Pattern$Tuple)
101+
102+
0 commit comments