summaryrefslogtreecommitdiff
path: root/chapter29/src/test/java/com/seaofnodes/simple/test5
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-11-01 10:33:55 -0800
committerCliff Click <cliffc@acm.org>2026-11-01 10:33:55 -0800
commitf4bd723d929e53475f7990374dca7b7dfcbbdc42 (patch)
tree7bb080119e7b88ad4ac9b30af019fe6a5e4ba9dd /chapter29/src/test/java/com/seaofnodes/simple/test5
parent0ac0c9e10287972ac3af5a4ee43d26f0d5b318fe (diff)
downloadSimple-main.tar.gz
Simple-main.zip
Add Chapter 29 for tech debt cleanup with the parser splitmain
Keep Chapter 28b intact and carry the grammar-oriented parser package, Var move, IterPeeps move, and parser regression tests into Chapter 29. Defer privacy and exclude its experimental tests and fixture changes. Register the chapter in the indexes, IntelliJ modules and run configurations, Maven reactor, roadmap, and linear-history publisher. Windows and Linux each pass 573 tests, release builds, 199 allocation replays, and 29 native checks.
Diffstat (limited to 'chapter29/src/test/java/com/seaofnodes/simple/test5')
-rw-r--r--chapter29/src/test/java/com/seaofnodes/simple/test5/par.smp20
-rw-r--r--chapter29/src/test/java/com/seaofnodes/simple/test5/par/child1.smp12
-rw-r--r--chapter29/src/test/java/com/seaofnodes/simple/test5/par/child2.smp13
3 files changed, 45 insertions, 0 deletions
diff --git a/chapter29/src/test/java/com/seaofnodes/simple/test5/par.smp b/chapter29/src/test/java/com/seaofnodes/simple/test5/par.smp
new file mode 100644
index 00000000..f19bd57b
--- /dev/null
+++ b/chapter29/src/test/java/com/seaofnodes/simple/test5/par.smp
@@ -0,0 +1,20 @@
+// -*- mode: java; -*-
+
+// Parent module
+val par0 = 3; // Some final field
+
+// Nested class in parent.
+// Makes a field: "val child0 = ..."
+struct child0 {
+ val kid0 = 5;
+};
+
+// Nested class in parent, comes from disk.
+// These are defined in-order
+val child1 = child1;
+
+// Nested class in parent, comes from disk
+val child2 = child2;
+
+// Nested class in parent, comes from disk
+val child3 = child3;
diff --git a/chapter29/src/test/java/com/seaofnodes/simple/test5/par/child1.smp b/chapter29/src/test/java/com/seaofnodes/simple/test5/par/child1.smp
new file mode 100644
index 00000000..7bca0cf7
--- /dev/null
+++ b/chapter29/src/test/java/com/seaofnodes/simple/test5/par/child1.smp
@@ -0,0 +1,12 @@
+// -*- mode: java; -*-
+
+// Child module
+
+// Same field name as child2
+val kid1 = 7;
+
+// Can read parent directly
+val kid2 = par0;
+
+// Error to reference a later sibling
+// val kid3 = par.child2.kid1;
diff --git a/chapter29/src/test/java/com/seaofnodes/simple/test5/par/child2.smp b/chapter29/src/test/java/com/seaofnodes/simple/test5/par/child2.smp
new file mode 100644
index 00000000..ab5e2ac1
--- /dev/null
+++ b/chapter29/src/test/java/com/seaofnodes/simple/test5/par/child2.smp
@@ -0,0 +1,13 @@
+// -*- mode: java; -*-
+
+// Child module
+
+// Same field name as child2
+val kid1 = 11;
+
+// Can read parent directly.
+// Can read defined-in-parent fields.
+val kid2 = child0.kid0;
+
+// OK to reference a past sibling
+val kid3 = child1.kid1;