File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
hkmc2/shared/src/test/mlscript/bbml Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -111,3 +111,41 @@ k(_ => "")
111
111
112
112
k(_ => 42)
113
113
//│ 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
You can’t perform that action at this time.
0 commit comments