[SwiftLexicalLookup] Implement the first step of type resolution - #3399
Merged
Conversation
filip-sakel
force-pushed
the
partial-type-resolution
branch
from
August 7, 2026 15:23
58d8c92 to
7da1d64
Compare
…ce from TypeLikeSyntaxProtocol to match other syntax protocols.
filip-sakel
force-pushed
the
partial-type-resolution
branch
from
August 7, 2026 15:29
7da1d64 to
d78f792
Compare
Contributor
Author
|
I trimmed down some changes to make the PR easier to review. I forced pushed to maintain a clean history, since this was still a draft PR. |
filip-sakel
marked this pull request as ready for review
August 7, 2026 17:13
filip-sakel
requested review from
hamishknight,
hborla,
rintaro and
xedin
as code owners
August 7, 2026 17:13
Contributor
Author
|
@swift-ci please test Linux Platform |
Contributor
Author
|
@swift-ci please test Linux platform |
Contributor
Author
|
@swift-ci please test |
xedin
approved these changes
Aug 10, 2026
Contributor
Author
|
@swift-ci please test |
Contributor
Author
|
@swift-ci please test Windows platform |
Contributor
Author
|
@swift-ci please test Wasm platform |
Contributor
Author
|
@swift-ci please test Wasm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up to #3390 for the qualified name-lookup GSoC 2026 project. Introduces (partial) type resolution.
Changes
Partial Type Resolution
"Partial" type resolution in this PR takes type syntax and basically resolves to a non-nominal type (
Any, tuple, function), a type identifier, a member type, or a composition. The future type-resolver machinery will then do one of the following: return the non-nominal type, perform unqualified lookup for identifier types, qualified lookup for member types, or resolve each type in a composition. I call this "partial" resolution because compositions and member types still have type syntax as their children.Attached
The
Attached<Node>type describes a syntax node attached to aSourceFileSyntaxroot (juxtaposed withSyntaxProtocol/detached). Ensuring that a given syntax is part of a file is very useful for later steps, where we want to find the module in which a type is declared. In addition, 'casting' nodes toAttached` makes us more careful about only admitting known/registered files to the type graph.Notes:
Attacheddoesn't storeSourceFileRootas a property since it already containsroot; storing an additional property would just pollute the cacheAttacheddoesn't conform toSyntaxProtocolbecause its initializer takes in the type'sNodegeneric parameter and not an arbitrarysome SyntaxProtocol. However, we provide similar casting methods and convenience properties, so users ofAttachedget a similar interface.Open Questions
.self?