Skip to content

Support extension modifier on children declarations#1117

Open
mbouaziz wants to merge 1 commit intomainfrom
extension-children
Open

Support extension modifier on children declarations#1117
mbouaziz wants to merge 1 commit intomainfrom
extension-children

Conversation

@mbouaziz
Copy link
Contributor

Summary

  • Implements Feature request: extension children #1017: adds extension modifier support on children declarations
  • Per-child syntax: | extension A marks individual children as extension classes
  • Blanket syntax: extension children = | A | B marks all children as extension classes

Changes

  • AST: Added chi_extension: ?FileRange to Child
  • Parse tree: Added extension field to ChildClassTree, modifiers field to ChildrenTree
  • Parser: Recognizes extension as a class member modifier, allows it on children and individual child classes
  • Conversion: Propagates per-child and blanket extension to AST
  • Expand: Passes chi_extension through to desugared Class_def
  • Printer/skfmt: Prints extension on children and child classes

Test plan

  • New test extension_children_per_child — validates | extension A() syntax
  • New test extension_children_blanket — validates extension children = syntax
  • Updated modifier_children error test — error message now says "Only 'extension' modifier is permitted"
  • All 1702 existing tests pass

🤖 Generated with Claude Code

Add two new syntactic forms for declaring extension children:
- Per-child: `| extension A` marks individual children as extension classes
- Blanket: `extension children = | A | B` marks all children as extension

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant