summaryrefslogtreecommitdiff
path: root/chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-11-08 14:10:02 -0800
committerCliff Click <cliffc@acm.org>2026-11-08 14:10:02 -0800
commit06fb5aceeb65a75b1cd643debd667c52fdcafcb9 (patch)
treec99813eaf27d98f840245302c4d6e923c964307e /chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java
parent6560a92433a38825fd1d44d9c66ffba9f26990ff (diff)
downloadSimple-ch30.tar.gz
Simple-ch30.zip
Better error messagesch30
Better error messages. Buffs to the std lib; getch() to fetch a single character; streaming I/O handles retries, and large sizes, with better error reporting. Formatted strings. Default int moved to i32. TicTacToe, the game.
Diffstat (limited to 'chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java')
-rw-r--r--chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java b/chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java
index cfc0b7e0..1853aa48 100644
--- a/chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java
+++ b/chapter30/src/test/java/com/seaofnodes/simple/SeparateCompilationTest.java
@@ -18,9 +18,9 @@ public class SeparateCompilationTest {
val run={int n ->
val power={int base,int exponent ->
if(exponent<=0) return 1;
- return base*power(base,exponent-1);
+ return base*power(base,--exponent);
};
- { {int int -> int} -> int } retain="C";
+ { {int int -> i64} -> int } retain="C";
retain(power);
return power(2,n);
};
@@ -28,14 +28,14 @@ public class SeparateCompilationTest {
new CodeGen(null,lib.toString(),null,"Callbacks",src,123,true,TypeInteger.BOT)
.driver(TestC.CPU_PORT,TestC.CALL_CONVENTION,false,false);
CodeGen code=new CodeGen(null,null,new Ary<>(new String[]{lib.toString()}),
- "Client","return Callbacks.run(arg);",123,true,TypeInteger.BOT)
+ "Client","return Callbacks.run(((arg<<32)>>32));",123,true,TypeInteger.BOT)
.driver(CodeGen.Phase.Opto);
// This assertion inspects a body, not just its saved summary.
ParseAll.loadCompUnit(code,code._compunits.get("Callbacks"));
assertNull(code._compunits.get("Callbacks")._src);
ParmNode base=code._start.walk(n -> n instanceof ParmNode p && p._label.equals("base") ? p : null);
assertNotNull(base);
- assertSame("Native code may call the saved callback with any base",TypeInteger.BOT,base._type);
+ assertSame("Native code may call the saved callback with any base",TypeInteger.I32,base._type);
code.driver(CodeGen.Phase.TypeCheck);
}