Skip to content

Name resolution: a visible module's type candidate is returned before the scoped-binding tier, so a module type T can shadow a generic parameter T during specialization #1967

Closed

Description

@ehartford

Noted while fixing #1955 (lookup_named_type_filtered, Sema.w): a visible module candidate is returned before the scoped-binding tier (Self, generic type parameters inserted into named_types directly). A module declaring pub type T imported by a generic fn f[T](…) could resolve T inside the specialization to the module's type. Needs a failing-first fixture (generic fn + imported module with a same-named type, instantiate, observe which T the body sees) and the precedence fixed so scoped bindings win, with the #1955 fixture's order-check coverage.

Activity

  1. added
    bug
    on Oct 2, 2026
  2. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by 792351b (stack #2007, battery green on 0f13a62). A scoped type binding (Self, a generic parameter) wins over a visible module candidate; type-parameter frames are restored last-to-first (three sites).

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions