|
4 | 4 |
|
5 | 5 | false |
6 | 6 | //│ Wasm result: |
7 | | -//│ FAILURE: Unexpected runtime error |
8 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
9 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
10 | | -//│ at REPL7:1:33 |
11 | | -//│ at REPL7:2:4 |
12 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
13 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
14 | | -//│ at bound (node:domain:433:15) |
15 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
16 | | -//│ at REPLServer.onLine (node:repl:922:10) |
17 | | -//│ at REPLServer.emit (node:events:518:28) |
18 | | -//│ at REPLServer.emit (node:domain:489:12) |
19 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 7 | +//│ = 0 |
20 | 8 |
|
21 | 9 |
|
22 | 10 | true |
23 | 11 | //│ Wasm result: |
24 | | -//│ FAILURE: Unexpected runtime error |
25 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
26 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
27 | | -//│ at REPL8:1:33 |
28 | | -//│ at REPL8:2:4 |
29 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
30 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
31 | | -//│ at bound (node:domain:433:15) |
32 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
33 | | -//│ at REPLServer.onLine (node:repl:922:10) |
34 | | -//│ at REPLServer.emit (node:events:518:28) |
35 | | -//│ at REPLServer.emit (node:domain:489:12) |
36 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 12 | +//│ = 1 |
37 | 13 |
|
38 | 14 |
|
39 | 15 | 2 |
40 | 16 | //│ Wasm result: |
41 | | -//│ FAILURE: Unexpected runtime error |
42 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
43 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
44 | | -//│ at REPL9:1:33 |
45 | | -//│ at REPL9:2:4 |
46 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
47 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
48 | | -//│ at bound (node:domain:433:15) |
49 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
50 | | -//│ at REPLServer.onLine (node:repl:922:10) |
51 | | -//│ at REPLServer.emit (node:events:518:28) |
52 | | -//│ at REPLServer.emit (node:domain:489:12) |
53 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 17 | +//│ = 2 |
54 | 18 |
|
55 | 19 |
|
56 | 20 | 1 + 1 |
57 | 21 | //│ Wasm result: |
58 | | -//│ FAILURE: Unexpected runtime error |
59 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
60 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
61 | | -//│ at REPL10:1:33 |
62 | | -//│ at REPL10:2:4 |
63 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
64 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
65 | | -//│ at bound (node:domain:433:15) |
66 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
67 | | -//│ at REPLServer.onLine (node:repl:922:10) |
68 | | -//│ at REPLServer.emit (node:events:518:28) |
69 | | -//│ at REPLServer.emit (node:domain:489:12) |
70 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 22 | +//│ = 2 |
71 | 23 |
|
72 | 24 |
|
73 | 25 | let x = 0 |
74 | 26 | x |
75 | 27 | //│ Wasm result: |
76 | | -//│ FAILURE: Unexpected runtime error |
77 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
78 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
79 | | -//│ at REPL11:1:33 |
80 | | -//│ at REPL11:2:4 |
81 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
82 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
83 | | -//│ at bound (node:domain:433:15) |
84 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
85 | | -//│ at REPLServer.onLine (node:repl:922:10) |
86 | | -//│ at REPLServer.emit (node:events:518:28) |
87 | | -//│ at REPLServer.emit (node:domain:489:12) |
88 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 28 | +//│ = 0 |
89 | 29 |
|
90 | 30 |
|
91 | 31 | :ge |
92 | 32 | fun foo() = 42 |
93 | 33 | foo |
94 | 34 | //│ ╔══[COMPILATION ERROR] Returning function instances is not supported |
95 | | -//│ ║ l.93: foo |
| 35 | +//│ ║ l.33: foo |
96 | 36 | //│ ╙── ^^^ |
97 | 37 |
|
98 | 38 |
|
99 | 39 | fun foo() = 42 |
100 | 40 | foo() |
101 | 41 | //│ Wasm result: |
102 | | -//│ FAILURE: Unexpected runtime error |
103 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
104 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
105 | | -//│ at REPL12:1:33 |
106 | | -//│ at REPL12:2:4 |
107 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
108 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
109 | | -//│ at bound (node:domain:433:15) |
110 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
111 | | -//│ at REPLServer.onLine (node:repl:922:10) |
112 | | -//│ at REPLServer.emit (node:events:518:28) |
113 | | -//│ at REPLServer.emit (node:domain:489:12) |
114 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 42 | +//│ = 42 |
115 | 43 |
|
116 | 44 |
|
117 | 45 | :wat |
@@ -164,70 +92,24 @@ foo() + foo() |
164 | 92 | //│ (export "entry" (func $entry)) |
165 | 93 | //│ (elem declare func $entry)) |
166 | 94 | //│ Wasm result: |
167 | | -//│ FAILURE: Unexpected runtime error |
168 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
169 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
170 | | -//│ at REPL13:1:33 |
171 | | -//│ at REPL13:2:4 |
172 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
173 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
174 | | -//│ at bound (node:domain:433:15) |
175 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
176 | | -//│ at REPLServer.onLine (node:repl:922:10) |
177 | | -//│ at REPLServer.emit (node:events:518:28) |
178 | | -//│ at REPLServer.emit (node:domain:489:12) |
179 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
| 95 | +//│ = 84 |
180 | 96 |
|
181 | 97 |
|
182 | 98 | fun foo(x) = x + 1 |
183 | 99 | foo(41) |
184 | 100 | //│ Wasm result: |
185 | | -//│ FAILURE: Unexpected runtime error |
186 | | -//│ FAILURE LOCATION: mkQuery (WasmDiffMaker.scala:128) |
187 | | -//│ ═══[RUNTIME ERROR] TypeError: Cannot read properties of undefined (reading 'binaryenPrintFuncRes') |
188 | | -//│ at REPL14:1:33 |
189 | | -//│ at REPL14:2:4 |
190 | | -//│ at ContextifyScript.runInThisContext (node:vm:137:12) |
191 | | -//│ at REPLServer.defaultEval (node:repl:593:22) |
192 | | -//│ at bound (node:domain:433:15) |
193 | | -//│ at REPLServer.runBound [as eval] (node:domain:444:12) |
194 | | -//│ at REPLServer.onLine (node:repl:922:10) |
195 | | -//│ at REPLServer.emit (node:events:518:28) |
196 | | -//│ at REPLServer.emit (node:domain:489:12) |
197 | | -//│ at [_onLine] [as _onLine] (node:internal/readline/interface:419:12) |
198 | | - |
| 101 | +//│ = 42 |
199 | 102 |
|
| 103 | +:lot |
200 | 104 | class Foo(val x) |
201 | 105 | new Foo(0) |
202 | | -//│ FAILURE: Unexpected compilation error |
203 | | -//│ FAILURE LOCATION: errExpr (WatBuilder.scala:262) |
204 | | -//│ FAILURE INFO: Block IR of `cls` expression: Ref(member:Foo,Some(class:Foo)) |
205 | | -//│ ╔══[COMPILATION ERROR] WatBuilder::result for Instantiate(...) where `cls` is not a Select(...) path not implemented yet |
206 | | -//│ ║ l.201: new Foo(0) |
207 | | -//│ ╙── ^^^ |
208 | | -//│ FAILURE: Unexpected exception |
209 | | -//│ /!!!\ Uncaught error: java.lang.UnsupportedOperationException: UnreachableType is a compiler-internal type and cannot be converted to WAT |
210 | | -//│ at: hkmc2.codegen.wasm.text.UnreachableType$.toWat(Wasm.scala:50) |
211 | | -//│ at: hkmc2.codegen.wasm.text.Type.asValType_$bang$$anonfun$1(Wasm.scala:36) |
212 | | -//│ at: scala.Option.getOrElse(Option.scala:201) |
213 | | -//│ at: hkmc2.codegen.wasm.text.Type.asValType_$bang(Wasm.scala:36) |
214 | | -//│ at: hkmc2.codegen.wasm.text.WatBuilder.returningTerm$$anonfun$6(WatBuilder.scala:537) |
215 | | -//│ at: scala.collection.immutable.List.map(List.scala:247) |
216 | | -//│ at: scala.collection.immutable.List.map(List.scala:79) |
217 | | -//│ at: hkmc2.codegen.wasm.text.WatBuilder.returningTerm(WatBuilder.scala:537) |
218 | | -//│ at: hkmc2.codegen.wasm.text.WatBuilder.block(WatBuilder.scala:634) |
219 | | -//│ at: hkmc2.codegen.wasm.text.WatBuilder.program(WatBuilder.scala:599) |
| 106 | +//│ Wasm result: |
| 107 | +//│ = {} |
220 | 108 |
|
221 | 109 |
|
222 | 110 | :wat |
223 | 111 | class Foo(val a) |
224 | 112 | (new Foo(42)).Foo#a |
225 | | -//│ FAILURE: Unexpected compilation error |
226 | | -//│ FAILURE LOCATION: errExpr (WatBuilder.scala:262) |
227 | | -//│ FAILURE INFO: Block IR of `cls` expression: Ref(member:Foo,Some(class:Foo)) |
228 | | -//│ ╔══[COMPILATION ERROR] WatBuilder::result for Instantiate(...) where `cls` is not a Select(...) path not implemented yet |
229 | | -//│ ║ l.224: (new Foo(42)).Foo#a |
230 | | -//│ ╙── ^^^ |
231 | 113 | //│ Wat: |
232 | 114 | //│ (module |
233 | 115 | //│ (type $Foo (struct (field $a (mut (ref null any))))) |
@@ -255,9 +137,13 @@ class Foo(val a) |
255 | 137 | //│ (nop) |
256 | 138 | //│ (block (result (ref null any)) |
257 | 139 | //│ (local.set $tmp |
258 | | -//│ (unreachable)) |
| 140 | +//│ (call $Foo |
| 141 | +//│ (ref.i31 |
| 142 | +//│ (i32.const 42)))) |
259 | 143 | //│ (struct.get $Foo 0 |
260 | 144 | //│ (ref.cast (ref $Foo) |
261 | 145 | //│ (local.get $tmp)))))) |
262 | 146 | //│ (export "entry" (func $entry)) |
263 | 147 | //│ (elem declare func $entry)) |
| 148 | +//│ Wasm result: |
| 149 | +//│ = 42 |
0 commit comments