diff --git a/.trinity/seals/AdamW.json b/.trinity/seals/AdamW.json index fccdb3264..88e35f7f5 100644 --- a/.trinity/seals/AdamW.json +++ b/.trinity/seals/AdamW.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:908d7c055474530a0a1190a6bdd8ac715d72cb7d5eaedf9d6dcd85f3ab673c77", + "gen_hash_c": "sha256:69f5af10816f1fc51f184d3e6ac47110ed0a06723335f7b8f7e11c0d7bc357f7", "gen_hash_rust": "sha256:20969877473efdd38111fb8dba59cd02c5f11dfcdec7bccca52357d51e6474f5", "gen_hash_verilog": "sha256:b4c627e61a5f93624f5901ceb1386f761e68bb8ad1756fd90be8c727871f667c", "gen_hash_zig": "sha256:eaaca634bf317cb126fa1f126fa9c5171c9951cb2831d4a8a0cde5496c7c1a41", "module": "AdamW", "ring": 12, - "sealed_at": "2026-09-08T04:58:00Z", + "sealed_at": "2026-09-08T07:24:13Z", "spec_hash": "sha256:a5dbcb7030b094474aaaa271acb30a8e360843416a8ce98070bfee8cc66ae80b", "spec_path": "specs/ml/optimizer/adamw.t27" } \ No newline at end of file diff --git a/.trinity/seals/SacredAttention.json b/.trinity/seals/SacredAttention.json index f5cf442aa..f48280240 100644 --- a/.trinity/seals/SacredAttention.json +++ b/.trinity/seals/SacredAttention.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:3851ee7227a9ca38ee2f2d1d5061db2560f809effd509a9032d2d521202bcb4a", + "gen_hash_c": "sha256:7addff61a5aa8bfbb4c7849dc107d9e1387d29936bfc5fe756181ca3876cb147", "gen_hash_rust": "sha256:0a4064c4d5ae45dda501198128042849e7b9f0b1b598012ddf8ff34367df1b72", "gen_hash_verilog": "sha256:495b48a5c98b7c1fccab460f017fcc48da428a1789ba23eaa7691edc1d0d9e13", "gen_hash_zig": "sha256:187bc0b9346fcc3d35ae53a9bad1be0fab2cfe59ddedbf8f61fe4a2856f4cd36", "module": "SacredAttention", "ring": 12, - "sealed_at": "2026-09-08T04:37:30Z", + "sealed_at": "2026-09-08T07:24:13Z", "spec_hash": "sha256:be83d2a916a15957502d6afa4d6eff7ab07d0373e81555704ee842500db47187", "spec_path": "specs/nn/attention.t27" } \ No newline at end of file diff --git a/.trinity/seals/cloud-railway-deploy.json b/.trinity/seals/cloud-railway-deploy.json index 471bf7499..470e887ff 100644 --- a/.trinity/seals/cloud-railway-deploy.json +++ b/.trinity/seals/cloud-railway-deploy.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:c28a47ff5967112db4c145d16ce29a293e051f88f7c3056f698dd01631a38336", + "gen_hash_c": "sha256:2eb75718be19e6b8ed1d9b328bd9cb5856a3b5c54982cc455ca96487609c9cbf", "gen_hash_rust": "sha256:1dd515089d4fc9eb26525fc72a6ea446fd1afbf2f02a2c11f9f0b350a6b9d648", "gen_hash_verilog": "sha256:fe9bfbdfe7aadce3f908023b6cc0a0430eefbfdcb74c75e78299db56d22e25d8", "gen_hash_zig": "sha256:cf5a9d481565a4ea277bf8c9a7777d9f5e192d66dd950d68df6638f6feee8dae", "module": "cloud-railway-deploy", "ring": 12, - "sealed_at": "2026-09-08T00:32:45Z", + "sealed_at": "2026-09-08T07:24:11Z", "spec_hash": "sha256:fe78e70813d0e3d95b70cbf96474baa05dc866c856d2b6cd4ab7036043071364", "spec_path": "specs/cloud/railway_deploy.t27" } \ No newline at end of file diff --git a/.trinity/seals/cloud_cloud-railway-deploy.json b/.trinity/seals/cloud_cloud-railway-deploy.json index 21aeea616..4e8911964 100644 --- a/.trinity/seals/cloud_cloud-railway-deploy.json +++ b/.trinity/seals/cloud_cloud-railway-deploy.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:c28a47ff5967112db4c145d16ce29a293e051f88f7c3056f698dd01631a38336", + "gen_hash_c": "sha256:2eb75718be19e6b8ed1d9b328bd9cb5856a3b5c54982cc455ca96487609c9cbf", "gen_hash_rust": "sha256:1dd515089d4fc9eb26525fc72a6ea446fd1afbf2f02a2c11f9f0b350a6b9d648", "gen_hash_verilog": "sha256:fe9bfbdfe7aadce3f908023b6cc0a0430eefbfdcb74c75e78299db56d22e25d8", "gen_hash_zig": "sha256:cf5a9d481565a4ea277bf8c9a7777d9f5e192d66dd950d68df6638f6feee8dae", "module": "cloud-railway-deploy", "ring": 12, - "sealed_at": "2026-09-08T00:32:45Z", + "sealed_at": "2026-09-08T07:24:11Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:fe78e70813d0e3d95b70cbf96474baa05dc866c856d2b6cd4ab7036043071364", "spec_path": "specs/cloud/railway_deploy.t27" diff --git a/.trinity/seals/compiler-mod-structure.json b/.trinity/seals/compiler-mod-structure.json index 383c9125f..24dd67508 100644 --- a/.trinity/seals/compiler-mod-structure.json +++ b/.trinity/seals/compiler-mod-structure.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:5672c53eb1e8130a6c54d3d934acfadab049b56305f2566deee4df2df093bfb8", + "gen_hash_c": "sha256:246ba23a60738d77c5ec3a4ac23b6daecebc6367c983c571b9b58c13da74a28d", "gen_hash_rust": "sha256:9faab8f1c0a80bada89afe5a2a6d9e168c42f914f40c63721ba525b22174c33f", "gen_hash_verilog": "sha256:4dfb39cb8256ee127d93cb27b27070a6138cf060008b77fee817402594fad250", "gen_hash_zig": "sha256:044709f8c9eabfdb6784e6b554e05d5d157e84115c5300eead5f7cc0d2705024", "module": "compiler-mod-structure", "ring": 12, - "sealed_at": "2026-09-08T00:32:45Z", + "sealed_at": "2026-09-08T07:24:12Z", "spec_hash": "sha256:dee8a1c4e2ac49ff01ec4228a43bdcb4364d4e68fa2d1d439b27c2d5bac584a7", "spec_path": "specs/compiler/mod_structure.t27" } \ No newline at end of file diff --git a/.trinity/seals/compiler_compiler-mod-structure.json b/.trinity/seals/compiler_compiler-mod-structure.json index 11adfb9d9..9f28b0ce8 100644 --- a/.trinity/seals/compiler_compiler-mod-structure.json +++ b/.trinity/seals/compiler_compiler-mod-structure.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:5672c53eb1e8130a6c54d3d934acfadab049b56305f2566deee4df2df093bfb8", + "gen_hash_c": "sha256:246ba23a60738d77c5ec3a4ac23b6daecebc6367c983c571b9b58c13da74a28d", "gen_hash_rust": "sha256:9faab8f1c0a80bada89afe5a2a6d9e168c42f914f40c63721ba525b22174c33f", "gen_hash_verilog": "sha256:4dfb39cb8256ee127d93cb27b27070a6138cf060008b77fee817402594fad250", "gen_hash_zig": "sha256:044709f8c9eabfdb6784e6b554e05d5d157e84115c5300eead5f7cc0d2705024", "module": "compiler-mod-structure", "ring": 12, - "sealed_at": "2026-09-08T00:32:45Z", + "sealed_at": "2026-09-08T07:24:12Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:dee8a1c4e2ac49ff01ec4228a43bdcb4364d4e68fa2d1d439b27c2d5bac584a7", "spec_path": "specs/compiler/mod_structure.t27" diff --git a/.trinity/seals/evaluation_IGLAMultiLangHarness.json b/.trinity/seals/evaluation_IGLAMultiLangHarness.json index 85c134bb2..1e9226128 100644 --- a/.trinity/seals/evaluation_IGLAMultiLangHarness.json +++ b/.trinity/seals/evaluation_IGLAMultiLangHarness.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:170329431d8641d787f00f7111c216cab0cf977f5813fe4bc2582ecca6640541", + "gen_hash_c": "sha256:4fab6944eeb2f7e88263b2b16794738257be4fc29a84fc43c9436321bd834b44", "gen_hash_rust": "sha256:a410938884d2d7da5f1167c3c55c5ed1dd417daa50baa0f80ac9a850431bb1fb", "gen_hash_verilog": "sha256:05a07e1e869e68974c58813656fe843c8b9411a999f00cfdac071ab2017a0735", "gen_hash_zig": "sha256:aaca9342300bfcc8d884259f809cbef1127d7045fb39bd30c8094f3225c8a54e", "module": "IGLAMultiLangHarness", "ring": 12, - "sealed_at": "2026-09-08T00:32:46Z", + "sealed_at": "2026-09-08T07:24:12Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:da869f75b0e66b078c82ff9989a637e2e81426f78d2ede00b74df9da126c18b5", "spec_path": "specs/igla/evaluation/multi_lang_harness.t27" diff --git a/.trinity/seals/integration_IGLAPublication.json b/.trinity/seals/integration_IGLAPublication.json index 2d4d61c76..cd3c98b3b 100644 --- a/.trinity/seals/integration_IGLAPublication.json +++ b/.trinity/seals/integration_IGLAPublication.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:554c912d4752d51c9142fd5f4e3eedb5d6ec6e0cac79d81479decb5d8791e824", + "gen_hash_c": "sha256:9e6b1f1b24ebfb28f3b76b4fc0da39820b87cd7135f848c6bab81ac8f24bf49d", "gen_hash_rust": "sha256:e69bec94609406362ebcc54808f591ccff9690e88148a92ae69f6d88fdfa0cf4", "gen_hash_verilog": "sha256:8d1d05f3ff07323c5a47ca8e489fc3967f1a98d4df9a3d32c02fbad9ec4e7cb4", "gen_hash_zig": "sha256:01718ce3aa9d14a7dc33e9a97abcd24b3996595911ecef0d00829ed24a354899", "module": "IGLAPublication", "ring": 12, - "sealed_at": "2026-09-05T03:11:56Z", + "sealed_at": "2026-09-08T07:24:12Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:3e203c4b90a1ef1483c84320fe17cee7a366467c3f49dfb90d785467cc48b5a1", "spec_path": "specs/igla/integration/publication.t27" diff --git a/.trinity/seals/lsp-schema.json b/.trinity/seals/lsp-schema.json index 446d0d6d3..38157ea86 100644 --- a/.trinity/seals/lsp-schema.json +++ b/.trinity/seals/lsp-schema.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:dd3538c7c7e9a6924066069a273b9e4b701fe62c2063258a795e32de897c4c2f", + "gen_hash_c": "sha256:a6e62ab3e6e7a6a453f6643134053350e9eebd69d81902d2a556e36983a26435", "gen_hash_rust": "sha256:a3a28d49b7967198b853e6790f8878c4fcbbae0fbc51614c34dca9e27089ec36", "gen_hash_verilog": "sha256:5b06ca806b28456c3c4f16241e53a756c97943d5fab60cad548fe2e0780d0df9", "gen_hash_zig": "sha256:9824374ed0c9d330a5729fb15b945d389345113c68b8ce61d14510ce270d41be", "module": "lsp-schema", "ring": 12, - "sealed_at": "2026-09-08T00:32:46Z", + "sealed_at": "2026-09-08T07:24:13Z", "spec_hash": "sha256:4c4543a14768e2353cf1981460c90b96fa26a9c05e049b5d504e07a9e244a0d4", "spec_path": "specs/lsp/schema.t27" } \ No newline at end of file diff --git a/.trinity/seals/lsp_lsp-schema.json b/.trinity/seals/lsp_lsp-schema.json index bd7812a80..2aa33fbb5 100644 --- a/.trinity/seals/lsp_lsp-schema.json +++ b/.trinity/seals/lsp_lsp-schema.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:dd3538c7c7e9a6924066069a273b9e4b701fe62c2063258a795e32de897c4c2f", + "gen_hash_c": "sha256:a6e62ab3e6e7a6a453f6643134053350e9eebd69d81902d2a556e36983a26435", "gen_hash_rust": "sha256:a3a28d49b7967198b853e6790f8878c4fcbbae0fbc51614c34dca9e27089ec36", "gen_hash_verilog": "sha256:5b06ca806b28456c3c4f16241e53a756c97943d5fab60cad548fe2e0780d0df9", "gen_hash_zig": "sha256:9824374ed0c9d330a5729fb15b945d389345113c68b8ce61d14510ce270d41be", "module": "lsp-schema", "ring": 12, - "sealed_at": "2026-09-08T00:32:46Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:4c4543a14768e2353cf1981460c90b96fa26a9c05e049b5d504e07a9e244a0d4", "spec_path": "specs/lsp/schema.t27" diff --git a/.trinity/seals/nn_SacredAttention.json b/.trinity/seals/nn_SacredAttention.json index 140025a74..ca7cadfbc 100644 --- a/.trinity/seals/nn_SacredAttention.json +++ b/.trinity/seals/nn_SacredAttention.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:3851ee7227a9ca38ee2f2d1d5061db2560f809effd509a9032d2d521202bcb4a", + "gen_hash_c": "sha256:7addff61a5aa8bfbb4c7849dc107d9e1387d29936bfc5fe756181ca3876cb147", "gen_hash_rust": "sha256:0a4064c4d5ae45dda501198128042849e7b9f0b1b598012ddf8ff34367df1b72", "gen_hash_verilog": "sha256:495b48a5c98b7c1fccab460f017fcc48da428a1789ba23eaa7691edc1d0d9e13", "gen_hash_zig": "sha256:187bc0b9346fcc3d35ae53a9bad1be0fab2cfe59ddedbf8f61fe4a2856f4cd36", "module": "SacredAttention", "ring": 12, - "sealed_at": "2026-09-08T04:37:30Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:be83d2a916a15957502d6afa4d6eff7ab07d0373e81555704ee842500db47187", "spec_path": "specs/nn/attention.t27" diff --git a/.trinity/seals/optimizer_AdamW.json b/.trinity/seals/optimizer_AdamW.json index fc3b0fbb0..3a2043090 100644 --- a/.trinity/seals/optimizer_AdamW.json +++ b/.trinity/seals/optimizer_AdamW.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:908d7c055474530a0a1190a6bdd8ac715d72cb7d5eaedf9d6dcd85f3ab673c77", + "gen_hash_c": "sha256:69f5af10816f1fc51f184d3e6ac47110ed0a06723335f7b8f7e11c0d7bc357f7", "gen_hash_rust": "sha256:20969877473efdd38111fb8dba59cd02c5f11dfcdec7bccca52357d51e6474f5", "gen_hash_verilog": "sha256:b4c627e61a5f93624f5901ceb1386f761e68bb8ad1756fd90be8c727871f667c", "gen_hash_zig": "sha256:eaaca634bf317cb126fa1f126fa9c5171c9951cb2831d4a8a0cde5496c7c1a41", "module": "AdamW", "ring": 12, - "sealed_at": "2026-09-08T04:58:00Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:a5dbcb7030b094474aaaa271acb30a8e360843416a8ce98070bfee8cc66ae80b", "spec_path": "specs/ml/optimizer/adamw.t27" diff --git a/.trinity/seals/race_igla-race-formal.json b/.trinity/seals/race_igla-race-formal.json index ca565d623..01b41cf26 100644 --- a/.trinity/seals/race_igla-race-formal.json +++ b/.trinity/seals/race_igla-race-formal.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:8616968af7c1b36a38bcde30478bb01c5209e38f79e039e91b0068dcfd809bab", + "gen_hash_c": "sha256:eb76141736f3e2dce28dea0e77b51a6f3cc64e7a247fe851af410f372e97eb99", "gen_hash_rust": "sha256:ea1f827ca19b22e3ca6891373616fe8e8616163b808484761516afd86a411bc3", "gen_hash_verilog": "sha256:7421eb4c0f42655307219fd1582d1040ef59aecbac9bce503cb7f35530f936ff", "gen_hash_zig": "sha256:15bef725b0b0ba4f612e3ca8682df6566609c308a37f8718ec95f458a6b713c7", "module": "igla-race-formal", "ring": 12, - "sealed_at": "2026-09-08T03:43:40Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:948f99458634d60de75826a7ad8e6d85543f9f017c1a6dc77b6580f29699bf01", "spec_path": "specs/igla/race/formal.t27" diff --git a/.trinity/seals/training_IGLALowBitTernary.json b/.trinity/seals/training_IGLALowBitTernary.json index 3e012b7d8..2c5460734 100644 --- a/.trinity/seals/training_IGLALowBitTernary.json +++ b/.trinity/seals/training_IGLALowBitTernary.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:146d06ce7921eef29a1278a02f483f34259e8cba799f1e0f54ad23ef1c3ff14e", + "gen_hash_c": "sha256:287cd4021467984c9d9936696e7d08918bbe35c00fca9a0a742f3cc1b1187d94", "gen_hash_rust": "sha256:8e2643482c80b8190c87f45cc4a6d5b7e945bce6f9c8be5d0a6e241ae0990d5d", "gen_hash_verilog": "sha256:885ab9f2b35be89e8aa9d9575689d6a9f2cc03794014fe6dbb7bf0856f2e4eca", "gen_hash_zig": "sha256:5c5f2160dba70aac05ed6d4e98d6853190f4dd1f4577475bd43eefa1a8536136", "module": "IGLALowBitTernary", "ring": 12, - "sealed_at": "2026-09-08T00:32:46Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:71a93868a8177593f4fdae670dce0714895a9ecaadd2d4a09e2c7d84c415e962", "spec_path": "specs/igla/training/low_bit_ternary.t27" diff --git a/.trinity/seals/training_IGLAPilotPretraining.json b/.trinity/seals/training_IGLAPilotPretraining.json index a3de19a1c..3bc93e42e 100644 --- a/.trinity/seals/training_IGLAPilotPretraining.json +++ b/.trinity/seals/training_IGLAPilotPretraining.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:c67c1bba9311c6b1cdd0bd754445ec94b56be8eef627b43e70820f5f818954a7", + "gen_hash_c": "sha256:b0bef9bd9b1bb51c169c7041f44c5b708d609bb65d1da642543b342f67999138", "gen_hash_rust": "sha256:988e54a0943565f28afaeac61b318999562ac9aedee7550e340c2d7e8df348e9", "gen_hash_verilog": "sha256:6d027364eb4753d19fa5fb954ec59de60545617ca1f9818e3176a76148d25676", "gen_hash_zig": "sha256:88b87f51e2349618c9ef1da8b065aeb82aa4eb849b20be9b947687393a764609", "module": "IGLAPilotPretraining", "ring": 12, - "sealed_at": "2026-09-08T00:32:46Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:051e8c6f568d660831950ec89c3148aa9219001db41877d1606d6ad5c019c53f", "spec_path": "specs/igla/training/pilot_pretraining.t27" diff --git a/.trinity/seals/training_IGLARoadmap.json b/.trinity/seals/training_IGLARoadmap.json index 0b28e5c50..11f81e5fd 100644 --- a/.trinity/seals/training_IGLARoadmap.json +++ b/.trinity/seals/training_IGLARoadmap.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:b681a06bea06c995216a3041b31ca54f34d10e613d11f56395266a4789423895", + "gen_hash_c": "sha256:e3daa498008ab5441dd5fa577b96f7673166f9f405b6997ad9b1ed8ac8d75d83", "gen_hash_rust": "sha256:12b856fe357b8670b658d7ae8b7333eb7cdb8fc2d4604400489c31a7c1c186cd", "gen_hash_verilog": "sha256:6e8051c39d737dfbfef1e9257bb254dd424b9ae25e47a5639cc88895363f6101", "gen_hash_zig": "sha256:36a5d011cc761b9d1e3b8e3e34cdc0140621734ae9c983e90bf6cd371978c47e", "module": "IGLARoadmap", "ring": 12, - "sealed_at": "2026-09-05T03:11:57Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:54d9c2d81be0a306a311a4e50ec767e81459c14f482a243a10e873a7654fa3ff", "spec_path": "specs/igla/training/roadmap.t27" diff --git a/.trinity/seals/training_IGLAScaleUp.json b/.trinity/seals/training_IGLAScaleUp.json index 9d7e32333..ed829ec94 100644 --- a/.trinity/seals/training_IGLAScaleUp.json +++ b/.trinity/seals/training_IGLAScaleUp.json @@ -1,11 +1,11 @@ { - "gen_hash_c": "sha256:3fc8bdd3040949cce686296c538f17fb083c75b689d655ade4a9c4c28b1074d9", + "gen_hash_c": "sha256:f93ae34043dc025076ae04c0d2bbae3c509f2d459751ae8c160f6b55d4732887", "gen_hash_rust": "sha256:c8ffec2ab768d10dfd697085f044c90e7fc5b3ed23e1988de527d21fefbefc65", "gen_hash_verilog": "sha256:3fa17e7c17262a55897c756ca2b418d3cc12fcad0e433716f29f4c214c3bb49f", "gen_hash_zig": "sha256:6cb78dbbf352d759eb2a4a99ebac65477546c65685236558a133e5aa0089d269", "module": "IGLAScaleUp", "ring": 12, - "sealed_at": "2026-09-08T00:32:46Z", + "sealed_at": "2026-09-08T07:24:13Z", "sealed_by": "t27c-bootstrap@0.2.0", "spec_hash": "sha256:eef7ff2a5ea1d0b9a6071f460170f8b0f9091199a6973402056f9af579e08c5c", "spec_path": "specs/igla/training/scale_up.t27" diff --git a/bootstrap/src/compiler.rs b/bootstrap/src/compiler.rs index 0e2a2da24..c877a49a9 100644 --- a/bootstrap/src/compiler.rs +++ b/bootstrap/src/compiler.rs @@ -18114,6 +18114,10 @@ pub struct CCodegen { /// type of its own; its consumer's parameter is declared, so the type is /// recoverable from the use. Zig has done this since W585. fn_param_types: std::collections::HashMap>, + /// Enums this module declares. `Trit.pos` is an ENUM MEMBER, and C has no + /// `Type.member`: the constant is named `TRIT_POS`. Without this set the + /// dotted form went into C verbatim. + c_enum_names: std::collections::HashSet, /// Scaffold binding name -> the C type recovered for it. scaffold_locals_c: std::collections::HashMap, /// t27 tuple return type of the function currently being emitted, so an @@ -18140,6 +18144,7 @@ impl CCodegen { module_name: String::new(), fn_return_types: std::collections::HashMap::new(), fn_param_types: std::collections::HashMap::new(), + c_enum_names: std::collections::HashSet::new(), scaffold_locals_c: std::collections::HashMap::new(), current_ret_tuple_type: None, current_ret_array_type: None, @@ -18681,6 +18686,13 @@ impl CCodegen { } // Section: Enums + // Recorded whether or not any enum is emitted here, because the + // dotted member form has to be recognised wherever it appears. + for e in &enums { + if !e.name.is_empty() { + self.c_enum_names.insert(e.name.clone()); + } + } if !enums.is_empty() { self.write_line("/* -------------------------------------------------------"); self.write_line(" Enums"); @@ -21008,6 +21020,28 @@ impl CCodegen { } } NodeKind::ExprFieldAccess => { + // An ENUM MEMBER, not a field. `Trit.pos` went into C verbatim + // and C has no `Type.member`: 1373 errors across 12 files, + // reported as `unexpected type name 'Trit'` and as undeclared + // `POS`/`NEG`. The constant `gen_c_enum` emits is + // `{TYPE}_{MEMBER}`, both upper-cased, so the two spellings are + // brought together here rather than a third one invented. + // + // Rust emits `Trit::pos` and Zig `Trit.pos`, both correct for + // their language; C was the only backend without an answer. + if let Some(base) = node.children.first() { + if base.kind == NodeKind::ExprIdentifier + && self.c_enum_names.contains(&base.name) + && !node.name.is_empty() + { + self.write(&format!( + "{}_{}", + base.name.to_uppercase(), + node.name.to_uppercase() + )); + return; + } + } if !node.children.is_empty() { self.gen_c_expr(&node.children[0]); } diff --git a/bootstrap/stage0/FROZEN_HASH b/bootstrap/stage0/FROZEN_HASH index 17237085c..82f71983a 100644 --- a/bootstrap/stage0/FROZEN_HASH +++ b/bootstrap/stage0/FROZEN_HASH @@ -1 +1 @@ -ef36d26b7f0e62f10358dbd6ec06624ae41af0bdfeee560a5c2038df43a8b7dc bootstrap/src/compiler.rs +c109ae58ae200cbd7f62636fb9d9128fb8c824f71fc0d943eb6ea043b58078ad bootstrap/src/compiler.rs diff --git a/bootstrap/tests/c_enum_member_access.rs b/bootstrap/tests/c_enum_member_access.rs new file mode 100644 index 000000000..32d2f5933 --- /dev/null +++ b/bootstrap/tests/c_enum_member_access.rs @@ -0,0 +1,124 @@ +//! `Trit.pos` is an ENUM MEMBER, and C has no `Type.member`. +//! +//! It went into C verbatim: **1373 errors across 12 files**, reported as +//! `unexpected type name 'Trit'` and as undeclared `POS`/`NEG`. The constant +//! `gen_c_enum` emits is `{TYPE}_{MEMBER}`, both upper-cased, so the two +//! spellings are brought together rather than a third one invented. +//! +//! Rust emits `Trit::pos` and Zig emits `Trit.pos`, each correct for its +//! language. C was the only backend without an answer -- the same shape as +//! every repair in this campaign. +//! +//! The discriminating case is a struct FIELD with the same name as an enum +//! member: `s.pos` must stay `s.pos`. The rewrite keys on the BASE being an +//! identifier that names a declared enum, not on the member's spelling. + +use std::process::Command; +use std::sync::atomic::{AtomicUsize, Ordering}; + +static N: AtomicUsize = AtomicUsize::new(0); + +fn cc_present() -> bool { + Command::new("cc").arg("--version").output().map(|o| o.status.success()).unwrap_or(false) +} + +fn gen_c(spec: &str, tag: &str) -> (String, std::path::PathBuf) { + let d = std::env::temp_dir().join(format!( + "t27c-cenum-{tag}-{}-{}", + std::process::id(), + N.fetch_add(1, Ordering::Relaxed) + )); + let _ = std::fs::remove_dir_all(&d); + std::fs::create_dir_all(&d).expect("dir"); + let p = d.join("in.t27"); + std::fs::write(&p, spec).expect("write"); + let out = Command::new(env!("CARGO_BIN_EXE_t27c")) + .arg("gen-c") + .arg(&p) + .output() + .expect("t27c"); + assert!(out.status.success(), "gen-c failed: {}", String::from_utf8_lossy(&out.stderr)); + (String::from_utf8_lossy(&out.stdout).to_string(), d) +} + +fn errors(h: &str, d: &std::path::Path) -> String { + let p = d.join("h.h"); + std::fs::write(&p, h).expect("write"); + let out = Command::new("cc") + .args(["-std=c11", "-Wall", "-Wextra", "-Wno-unused-parameter", + "-ferror-limit=0", "-fsyntax-only", "-x", "c"]) + .arg(&p) + .output() + .expect("cc"); + String::from_utf8_lossy(&out.stderr).to_string() +} + +#[test] +fn an_enum_member_becomes_the_c_constant() { + let (h, d) = gen_c( + "module P {\n enum Trit { pos, neg, zero }\n fn f(v: i32) -> i32 { var t = Trit.pos; return 0; }\n}\n", + "member", + ); + assert!(h.contains("__auto_type t = TRIT_POS;"), "got:\n{h}"); + assert!(!h.contains("Trit.pos"), "no dotted form may reach C:\n{h}"); + if cc_present() { + assert!(!errors(&h, &d).contains("error"), "and it must compile"); + } +} + +#[test] +fn the_constant_matches_what_the_enum_declaration_emits() { + // Stated as an agreement rather than as the literal `TRIT_POS`: if the + // naming rule in `gen_c_enum` ever changes, both must change together. + let (h, _d) = gen_c( + "module P {\n enum Colour { red, green }\n fn f(v: i32) -> i32 { var c = Colour.green; return 0; }\n}\n", + "agree", + ); + assert!(h.contains("COLOUR_GREEN,") || h.contains("COLOUR_GREEN\n"), "the declaration names it:\n{h}"); + assert!(h.contains("= COLOUR_GREEN;"), "and the use spells it the same way:\n{h}"); +} + +#[test] +fn a_struct_field_of_the_same_name_is_untouched() { + // The discriminating case. A rewrite keyed on the MEMBER name would break + // this; keying on the base being a declared enum does not. + let (h, d) = gen_c( + "module P {\n struct S { pos : i32, }\n enum Trit { pos, neg }\n fn f(s: S) -> i32 { var t = Trit.pos; return s.pos; }\n}\n", + "field", + ); + assert!(h.contains("return s.pos;"), "a struct field stays a field:\n{h}"); + assert!(h.contains("= TRIT_POS;"), "and the enum member still converts:\n{h}"); + if cc_present() { + assert!(!errors(&h, &d).contains("error"), "and it compiles"); + } +} + +#[test] +fn a_field_access_on_a_variable_is_untouched() { + // The base must be an identifier that NAMES A DECLARED ENUM. A variable + // called `t` of enum type is not that, and `t.something` is not a member + // constant. + let (h, _d) = gen_c( + "module P {\n struct S { a : i32, }\n fn f(s: S) -> i32 { return s.a; }\n}\n", + "var", + ); + assert!(h.contains("return s.a;"), "got:\n{h}"); + assert!(!h.contains("S_A"), "no enum-style constant may be invented:\n{h}"); +} + +#[test] +fn a_field_whose_name_is_an_enum_type_is_untouched() { + // The case that makes the BASE check load-bearing rather than decorative. + // A mutant keying on either side -- `contains(member) || contains(base)` -- + // survives every other test here, because no other test has a member whose + // name is also an enum type. `s.Colour` must stay a field access. + let (h, d) = gen_c( + "module P {\n enum Colour { red, green }\n struct S { Colour : i32, }\n fn f(s: S) -> i32 { return s.Colour; }\n}\n", + "collide", + ); + assert!(h.contains("return s.Colour;"), "a field named after an enum stays a field:\n{h}"); + assert!(!h.contains("S_COLOUR"), "and no constant is invented:\n{h}"); + if cc_present() { + assert!(!errors(&h, &d).contains("error"), "and it compiles"); + } +} diff --git a/docs/now/2026-09-08-the-ranking-paid-for-itself-in-one-pass.md b/docs/now/2026-09-08-the-ranking-paid-for-itself-in-one-pass.md new file mode 100644 index 000000000..bc3a4fe79 --- /dev/null +++ b/docs/now/2026-09-08-the-ranking-paid-for-itself-in-one-pass.md @@ -0,0 +1,9 @@ +# NOW -- The ranking paid for itself in one pass (2026-09-08) + +## The ranking paid for itself in one pass (Closes #3467) + +- The tool added last pass ranked the error classes for the first time and named a family nobody had looked at. One pass later it is **the largest single repair this campaign has made**: `Trit.pos` reaches C as `Trit.pos`, and C has no `Type.member`. Errors **14040 → 13340**, `unexpected type name 'Trit'` **642 → 12**, **15 files better and none worse**. `vsa/ops` 569 → 99. +- Only C is wrong: `gen-rust` emits `Trit::pos` and `gen-zig` emits `Trit.pos`, each correct for its language, while the constant `gen_c_enum` had been emitting all along is `TRIT_POS`. The declaration and the use had two spellings and nothing brought them together. +- **Half the family is a different defect and is filed as such.** `use of undeclared identifier 'POS'` (412) and `'NEG'` (319) are unchanged -- 731 errors over 422 lines, in `(a == NEG) ? ...` shapes. Those bare names appear **nowhere in the specs**: the compiler's own lowering introduces them without the type prefix. Same family by symptom, different repair, and saying so is cheaper than discovering it later. +- **A mutant survived on a guard that looked decorative.** Keying the rewrite on either side -- the member's name OR the base's -- passed every test, because no test had a member whose name was also an enum type. `struct S { Colour : i32 }` beside `enum Colour` is that case: `s.Colour` must stay a field access. Added, and the mutant dies. +- The measurement came before the code and earned it: printing the sites by shape showed 604 distinct lines all of one form, which is what made a single rewrite plausible before it was written.