feat: execute initialized compile-time type records

Recognize type-bearing storage syntactically so recursive nominal fields expand only after instance caching.
This commit is contained in:
2026-10-28 01:08:25 +01:00
parent 443de49d55
commit ae5314462a
5 changed files with 461 additions and 33 deletions
+12
View File
@@ -219,6 +219,15 @@ recompiles_specialized_calls_without_borrowing_previous_ir test {
` bias i16 = i16(copied[1][0] + rows[1][0])
` }
`}
`TypeRecord proc() type {
` Config :: struct { child type, counts [2]mut usize, bias i16 = 2 }
` config Config := { child = i8, counts = [0, 0] }
` original :: config
` config.child = i16
` for config.counts |_, index| { config.counts[index] = index + 1 }
` if (original.child != i8 or original.counts[1] != 0) return bool
` return struct { values [config.counts[1]]config.child, bias i16 = config.bias }
`}
`read_selected proc($choice Choice, value i16) i16 {
` match choice {
` .payload |detail|: {
@@ -268,6 +277,9 @@ recompiles_specialized_calls_without_borrowing_previous_ir test {
` initialized_values UninitializedValues() :: { values = [19, 21] }
` same_initialized_values UninitializedValues() :: initialized_values
` if (same_initialized_values.values[0] + same_initialized_values.values[1] + same_initialized_values.bias != 42) return 0
` type_record TypeRecord() :: { values = [19, 21] }
` same_type_record TypeRecord() :: type_record
` if (same_type_record.values[0] + same_type_record.values[1] + same_type_record.bias != 42) return 0
` copied_initialized = same_initialized.second
` payload :: packet.choices[0].payload
` if (payload.values[0] != 40 or payload.values[1] != 2 or payload.text.len != 2) return 0