Skip to content

Interfaces: implement validates, it does not copy implementations - #12597

Merged
0x6e merged 1 commit into
masterfrom
nathan/interfaces-validate-only
Jul 28, 2026
Merged

Interfaces: implement validates, it does not copy implementations#12597
0x6e merged 1 commit into
masterfrom
nathan/interfaces-validate-only

Conversation

@0x6e

@0x6e 0x6e commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

implement I <=> self; no longer copies an interface's property/callback/function declarations onto the component. Instead it validates that the component declares or inherits every member, with matching type, visibility, and (for callbacks/functions) purity, via validate_properties_and_callbacks and validate_function_implementations in object_tree/interfaces.rs. Both validators now run in object_tree.rs after all of a component's own property, callback, and function declarations are registered, so a locally declared member of the same name is found rather than misreported as missing; a same-named but wrong-kind local declaration (e.g. a callback where the interface expects a property) is now reported as a kind conflict instead.

Migrates every self-implementing component across the runtime test cases, compiler syntax tests, shipped widgets, and interface.mdx to explicitly declare the members their interfaces require, and updates the affected diagnostic wording to match the new validate-only semantics.

Where possible we have re-used the existing error messages as we intend to improve these in a future PR.

Relates to #1870.

@LeonMatthes LeonMatthes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty good, just some minor issues.

Comment thread docs/astro/src/content/docs/guide/experimental/interface.mdx Outdated
Comment thread docs/astro/src/content/docs/guide/experimental/interface.mdx Outdated
Comment thread internal/compiler/object_tree.rs
@0x6e
0x6e force-pushed the nathan/interfaces-validate-only branch from 75c2ac7 to e555b37 Compare July 27, 2026 10:52
@0x6e
0x6e requested a review from LeonMatthes July 27, 2026 10:53
…ace members

`implement I <=> self;` no longer copies an interface's
property/callback/function declarations onto the component. Instead it
validates that the component declares or inherits every member, with matching
type, visibility, and (for callbacks/functions) purity, via
`validate_properties_and_callbacks` and `validate_function_implementations` in
`object_tree/interfaces.rs`. Both validators now run in `object_tree.rs` after
all of a component's own property, callback, and function declarations are
registered, so a locally declared member of the same name is found rather than
misreported as missing; a same-named but wrong-kind local declaration (e.g. a
`callback` where the interface expects a `property`) is now reported as a kind
conflict instead.

Migrates every self-implementing component across the runtime test cases,
compiler syntax tests, shipped widgets, and interface.mdx to explicitly
declare the members their interfaces require, and updates the affected
diagnostic wording to match the new validate-only semantics.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@0x6e
0x6e force-pushed the nathan/interfaces-validate-only branch from 5e4787a to ee5e7e9 Compare July 27, 2026 20:10
@0x6e
0x6e merged commit 3439459 into master Jul 28, 2026
49 checks passed
@0x6e
0x6e deleted the nathan/interfaces-validate-only branch July 28, 2026 07:56
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