Skip to content

WIP: alternative/follow-up to #5739 — flatten embedded interface method sets#5833

Closed
ltzmaxwell wants to merge 9 commits into
gnolang:masterfrom
ltzmaxwell:scratch/iface-flatten
Closed

WIP: alternative/follow-up to #5739 — flatten embedded interface method sets#5833
ltzmaxwell wants to merge 9 commits into
gnolang:masterfrom
ltzmaxwell:scratch/iface-flatten

Conversation

@ltzmaxwell

Copy link
Copy Markdown
Contributor

Status: WIP / draft. Alternative to, and follow-up on, #5739. Stacked on fix/alias_2; until that merges this PR's diff also shows #5739's commits — the net-new change here is the single commit fix(gnovm): flatten embedded interface method sets for type identity.

#5739 makes embedded struct alias names take the written spelling (correct), and ships a minimal interface fix that only re-equalizes an embedded alias with its target (interface{ SAlias } == interface{ Stringer }). This PR replaces that minimal interface fix with the deeper one.

  • Flattens embedded interfaces into their method set at construction (doOpInterfaceType, staticTypeFromAST), so the embedded-interface name leaves the TypeID entirely. Interface identity becomes the flattened method set, matching Go.
  • Fixes a divergence that exists on master independent of fix(gnovm): embedded type identity — struct field name + interface method-set flatten #5739: interface{ Stringer } == interface{ Str() string } (and embed-of-two vs methods-listed, diamond dedup) — not just the alias case.
  • Keeps the runtime embedded-interface handling in FindEmbeddedFieldType/VerifyImplementedBy for already-persisted (pre-upgrade) state, whose Methods are still unflattened.
  • Same-name/different-signature conflicts are rejected by go/types before the VM builds the type, so the dedup panic is should-not-happen (consistent with existing construction-time guards).
  • Tests: iface_embed_id.gno (embed-vs-explicit, alias-vs-target, diamond); alias5.gno retained.

Consensus-breaking, distinct from #5739's struct break: anonymous-interface TypeIDs that embed other interfaces change. Must land with a chain upgrade.

Verified: Files -short, sdk/vm -run Gas, integration -run TestTestdata all green.

…elling

Interface identity is the method set, so interface{ SAlias } must equal interface{ Stringer }; only struct embeds take the written name. Adds alias5 regression test. interface{ Stringer } != interface{ Str()string } stays (pre-existing; needs method-set flattening, see TODO).
Replaces gnolang#5739's minimal interface-embed fix: instead of naming embeds from the resolved type, flatten embedded interfaces into their method set at construction, so the embed name leaves the TypeID entirely. interface{Stringer} == interface{Str()string} now holds too, not just alias-vs-target. Consensus-breaking (anonymous-interface TypeIDs change); land with a chain upgrade.
@Gno2D2

Gno2D2 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: ltzmaxwell/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@ltzmaxwell

Copy link
Copy Markdown
Contributor Author

Folded into #5739 — the flattening commit is now stacked there, so this standalone follow-up is redundant. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 🤖 gnovm Issues or PRs gnovm related

Projects

Development

Successfully merging this pull request may close these issues.

2 participants