summaryrefslogtreecommitdiff
path: root/src/test/java/com/seaofnodes/simple/FinalConstructionTest.java
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-08-10 11:11:18 -0700
committerCliff Click <cliffc@acm.org>2026-11-08 14:10:02 -0800
commit44505aa5b75b1046f13f2bc2a52fe0b16d975838 (patch)
treecc558485c807ac3842cd73943cf5e294c4a307de /src/test/java/com/seaofnodes/simple/FinalConstructionTest.java
parent2560096fb4636263798ae56c88687973c72cdf6e (diff)
downloadSimple-linear-chapter30.tar.gz
Simple-linear-chapter30.zip
Chapter 30: Text Formatting and Diagnosticslinear-chapter30
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: Symious <14933944+symious@users.noreply.github.com> Co-authored-by: Jun Kawasaki <jun784@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/FinalConstructionTest.java')
-rw-r--r--src/test/java/com/seaofnodes/simple/FinalConstructionTest.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/java/com/seaofnodes/simple/FinalConstructionTest.java b/src/test/java/com/seaofnodes/simple/FinalConstructionTest.java
index 66fdacc3..bdb71fc6 100644
--- a/src/test/java/com/seaofnodes/simple/FinalConstructionTest.java
+++ b/src/test/java/com/seaofnodes/simple/FinalConstructionTest.java
@@ -7,7 +7,7 @@ import static org.junit.Assert.*;
public class FinalConstructionTest {
private static final String LOOP = """
- val step={int x -> x*2+1;};
+ val step={i64 x -> x*2+1;};
struct C {
val x=1;
new C={int n ->
@@ -16,7 +16,7 @@ public class FinalConstructionTest {
};
val get={->x;};
};
- return new C(arg).get();
+ return new C(((arg<<32)>>32)).get();
""";
@Test public void testFinalConstructorFields() throws java.io.IOException {
@@ -27,10 +27,10 @@ public class FinalConstructionTest {
// Writes are ordinary Stores and may remain inside the loop.
String[] sources={
"struct C { val x=1; new C={->x=1; x=2;}; }; return new C().x;",
- "struct C { int ~x; new C={int n -> self.x=1; for(int i=0;i<n;i++) self.x*=2;}; }; return new C(arg).x;",
- "struct C { val x=1; new C={int n -> for(int i=0;i<n;i++) ++x;}; }; return new C(arg).x;",
+ "struct C { int ~x; new C={int n -> self.x=1; for(int i=0;i<n;i++) self.x*=2;}; }; return new C(((arg<<32)>>32)).x;",
+ "struct C { val x=1; new C={int n -> for(int i=0;i<n;i++) ++x;}; }; return new C(((arg<<32)>>32)).x;",
"struct C { val x=1.5; new C={->x=2.5;}; }; return new C().x;",
- "struct C { val x=\"a\"; new C={int n -> for(int i=0;i<n;i++) x=\"b\";}; }; return new C(arg).x[0];",
+ "struct C { val x=\"a\"; new C={int n -> for(int i=0;i<n;i++) x=\"b\";}; }; return new C(((arg<<32)>>32)).x[0];",
"struct C { val x=new int[1]; new C={->x=new int[2]; x=new int[3];}; }; return new C().x#;"
};
String[] results={"2","8","4","2.5","98","3"};