Skip to content

Commit bdbcf0f

Browse files
committed
Add more test cases
1 parent 2dd3333 commit bdbcf0f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

hkmc2/shared/src/test/mlscript/bbml/bbExtrude.mls

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,41 @@ k(_ => "")
111111

112112
k(_ => 42)
113113
//│ Type: Int
114+
115+
116+
fun k(x) =
117+
fun f: [S, T] -> S -> T
118+
fun f(y) = x(y)
119+
f(0) + 0
120+
k
121+
//│ Type: (⊤ -> ⊥) -> Int
122+
123+
124+
:e
125+
k(_ => "")
126+
//│ ╔══[ERROR] Type error in function literal with expected type 'x
127+
//│ ║ l.125: k(_ => "")
128+
//│ ║ ^^
129+
//│ ╟── because: cannot constrain ('_) ->{⊥} (Str) <: 'x
130+
//│ ╟── because: cannot constrain ('_) ->{⊥} (Str) <: 'x
131+
//│ ╟── because: cannot constrain ('_) ->{⊥} (Str) <: (⊤) ->{⊥} ⊥
132+
//│ ╙── because: cannot constrain Str <: ⊥
133+
//│ Type: Int
134+
135+
:e
136+
k(_ => 42)
137+
//│ ╔══[ERROR] Type error in function literal with expected type 'x
138+
//│ ║ l.136: k(_ => 42)
139+
//│ ║ ^^
140+
//│ ╟── because: cannot constrain ('_) ->{⊥} (Int) <: 'x
141+
//│ ╟── because: cannot constrain ('_) ->{⊥} (Int) <: 'x
142+
//│ ╟── because: cannot constrain ('_) ->{⊥} (Int) <: (⊤) ->{⊥} ⊥
143+
//│ ╙── because: cannot constrain Int <: ⊥
144+
//│ Type: Int
145+
146+
147+
fun k(x) =
148+
let f = y => x(y)
149+
f(0) + 0
150+
k
151+
//│ Type: ['eff] -> (Int ->{'eff} Int) ->{'eff} Int

0 commit comments

Comments
 (0)