Skip to content

Name-keyed registry cannot disambiguate a local plain class from a foreign reactive class with the same name #110

Description

@nank1ro

Problem

The cross-file registry is keyed by simple class name. When a file locally declares a plain class Foo AND holds (e.g. via an inherited super.thing typed in the base file's scope) a DIFFERENT, @SolidState-bearing Foo from another library, only one behavior is expressible:

Fix

Qualify registry entries by their origin library and disambiguate at rewrite time:

  1. Registry entries become name → [(originUri, scalar/collection fields)] — the one-hop threading already tracks origin URIs; stop dropping shadowed foreign entries, store them qualified.
  2. In the value rewriter's tier-1 (resolved staticType) path, compare the receiver's element library URI against the entry's origin — rewrite only on a match. thing (staticType = base file's Foo) lowers; f (staticType = local Foo) doesn't. Precise, not name-based.
  3. AST-only tiers (unresolved contexts) cannot know the library: under any same-name ambiguity (multiple entries, or an entry + a local declaration) keep today's conservative no-rewrite. The change can only ADD correct rewrites where real resolution exists — never introduce a wrong one.

This also narrows SPEC §4.9's documented name-collision caveat wherever tier-1 resolution applies.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions