Skip to content

feat(ast): brace initializers for scalars and structs - #74

Merged
rieske merged 1 commit into
masterfrom
feature/initializers
Jul 25, 2026
Merged

feat(ast): brace initializers for scalars and structs#74
rieske merged 1 commit into
masterfrom
feature/initializers

Conversation

@rieske

@rieske rieske commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Parse { e1, e2, … } into InitializerListExpression
  • Local scalar braces assign the single element; local struct braces store members by offset via FieldAddress
  • Functional InitializersTest

Stack

PR E of remaining track. Base: #73 (structs). Next: function pointers.

Test plan

  • Full local ctest
  • CI green / coverage non-regression

@mergify

mergify Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@rieske
rieske force-pushed the feature/initializers branch 2 times, most recently from f77f691 to 4c02dfb Compare July 24, 2026 13:57
@coveralls

coveralls commented Jul 24, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 93.196% (+0.03%) from 93.169% — feature/initializers into master

@rieske
rieske force-pushed the feature/initializers branch 2 times, most recently from 6755713 to ba5ca80 Compare July 25, 2026 06:32
@rieske
rieske force-pushed the feature/struct-member-access branch from 6f8820b to 12e5cc8 Compare July 25, 2026 07:19
@rieske
rieske force-pushed the feature/initializers branch from ba5ca80 to 8fce1b7 Compare July 25, 2026 07:19
@rieske
rieske force-pushed the feature/struct-member-access branch from 12e5cc8 to f0976fc Compare July 25, 2026 07:31
@rieske
rieske force-pushed the feature/initializers branch from 8fce1b7 to eac2cee Compare July 25, 2026 07:31
@rieske
rieske force-pushed the feature/struct-member-access branch from f0976fc to b70a025 Compare July 25, 2026 07:54
@rieske
rieske force-pushed the feature/initializers branch 3 times, most recently from a1c41a5 to 28e11ea Compare July 25, 2026 11:30
@rieske
rieske force-pushed the feature/struct-member-access branch from 109220e to f62d65f Compare July 25, 2026 11:33
@rieske
rieske force-pushed the feature/initializers branch from 28e11ea to 25bffc1 Compare July 25, 2026 11:33
Base automatically changed from feature/struct-member-access to master July 25, 2026 11:44
- InitializerListExpression + CSNB brace wiring
- lowerLocalInitializer writes StructFieldInit to AnnotationStore
- Codegen reads field inits from store (not AST)
- Nested braces rejected; excess diagnosed; per-member zero
@rieske
rieske force-pushed the feature/initializers branch from 25bffc1 to 20ee8fb Compare July 25, 2026 11:44
@rieske
rieske merged commit b209951 into master Jul 25, 2026
4 checks passed
@rieske
rieske deleted the feature/initializers branch July 25, 2026 12:07
rieske added a commit that referenced this pull request Jul 25, 2026
Remove the unbuilt InitializersTest (expects nested braces unimplemented;
feature implements them) and strip auto-merged popInitializerList APIs that
fight the expression-stack initializer list path.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init (local and global) so int x = { 7 } matches C and
the master InitializersTest intent, with excess-element diagnostics. Expand
functional coverage in themed suites (variadic, structs, errors, arrays,
casts, etc.) and AnnotationStore unit miss-paths to bring line rate back to
92.9%. Remove unbuilt InitializersTest and popInitializerList APIs that
conflicted with the expression-stack initializer path after the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init by peeling non-aggregate { e } at the declarator
(type-check, .data, CG assign) instead of treating lists as values. Expand
functional coverage in themed suites and AnnotationStore miss-paths to 92.9%.
C23 va_start(ap) uses the last named formal; __typeof__ compound literals
resolve the operand type. Diagnostics live in the SemanticErrors suite.
Remove unbuilt InitializersTest and popInitializerList APIs that conflicted
with the expression-stack initializer path after the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier and resolve to a real
type in SA. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier; SA resolveTypeSpecifier
writes a concrete type and clears provisional state, diagnosing unresolvable
operands. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier; SA resolveTypeSpecifier
writes a concrete type and clears provisional state, diagnosing unresolvable
operands. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier; SA resolveTypeSpecifier
writes a concrete type and clears provisional state, diagnosing unresolvable
operands. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier; SA resolveTypeSpecifier
writes a concrete type and clears provisional state, diagnosing unresolvable
operands. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier; SA resolveTypeSpecifier
writes a concrete type and clears provisional state, diagnosing unresolvable
operands. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
rieske added a commit that referenced this pull request Jul 26, 2026
…ris.

Support scalar brace init via shared effectiveInitializer peel (SA and CG).
Typeof type-names own their operand on TypeSpecifier; SA resolveTypeSpecifier
writes a concrete type and clears provisional state, diagnosing unresolvable
operands. Split global/local initializer application out of the declarator
analyzer. Expand functional coverage in themed suites and AnnotationStore
miss-paths to 92.9%. C23 va_start(ap) uses the last named formal. Diagnostics
live in the SemanticErrors suite. Remove unbuilt InitializersTest and
popInitializerList APIs that conflicted with the expression-stack path after
the PR #74 rebase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants