-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeResolver: Resolve Module.Type
as qualified type name
#69855
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please smoke test Linux |
auto ty = resolveType(repr->getBase(), options); | ||
baseOptions |= TypeResolutionFlags::DisallowOpaqueTypes; | ||
|
||
// The parser assumes 'X.Type' is a metatype representation, but it might be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of metatype representations and model them as a MemberTypeRepr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, but we will need two bits to disambiguate between X.Type
/X.Protocol
and X.`Type`
/X.`Protocol`
. Does that sound alright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just one isEscaped
bit for SimpleIdentTypeRepr
really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We absolutely need that bit to disambiguate in expression context anyway. Currently, both of these type-check as Int.Type.Type
instances:
extension Int {
struct `Type` {}
}
_ = Int.`Type`.self
_ = Int.Type.self
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s start with #70467.
auto *memberTR = | ||
MemberTypeRepr::create(ctx, {simpleIdentBase, memberComponent}); | ||
|
||
auto ty = resolveType(memberTR, options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Local ty
variable seems kind of ambiguous here as it has the same name as the one we resolve base type, wonder if would be better name then differently?
Resolves #67378.