Skip to content

SwiftLexicalLookup: Add Syntax Type Helpers for Member-Type Lookup#3378

Open
filip-sakel wants to merge 2 commits into
swiftlang:mainfrom
filip-sakel:qualified-type-lookup
Open

SwiftLexicalLookup: Add Syntax Type Helpers for Member-Type Lookup#3378
filip-sakel wants to merge 2 commits into
swiftlang:mainfrom
filip-sakel:qualified-type-lookup

Conversation

@filip-sakel

@filip-sakel filip-sakel commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

A follow-up to #3346 for the qualified name-lookup GSoC 2026 project.

Changes

  1. Add NominalTypeDeclSyntax (struct, enum, class, actor, or protocol)
  2. Add TypeDeclSyntax (a nominal type declaration, type alias, or associated/generic type)
    • Unqualified type lookup will return TypeDeclSyntax nodes
  3. Add TypeLikeSyntax (a TypeSyntax or NominalTypeDeclSyntax)
    • Helps us track where a type-resolution request originated
    • For instance:
      struct A {
         func f(b: B) {} // <- Look up `B` here
      }
      extension A { struct B {} }
      When looking up B, we first look for member types of A, which means we generate a request to fully resolve A. Note that no type syntax references A; instead, we resolve A because the syntax is nested in a nominal-type declaration. TypeLikeSyntax allows us to represent struct A as the syntax initiating the request.
  4. Rename old NominalTypeDeclSyntax->NonProtocolNominalTypeDeclSyntax.
    • This type is used internally to implement unqualified lookup

@filip-sakel

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

1 similar comment
@filip-sakel

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

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