-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Highlight angle brackets <…> in diagnostics #781
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
Conversation
Provide fixit hints for ungeneric but specialized types (e.g. Int<Float>). Solves FIXME
Highlight the angle brackets on under- and overspecialized types. (E.g. Array<Int, Float> and Dictionary<Int>) Solves FIXME
MutableArrayRef<TypeLoc> genericArgs, | ||
bool isGenericSignature, | ||
GenericTypeResolver *resolver); | ||
Type applyUnboundGenericArguments(UnboundGenericType *unbound, |
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.
Is it ok to pass an UnboundGenericType
or should it be wrapped inside a Type
value?
With the previous commit the emitted diagnostics couldn't be easily emitted through the public API. This commit solves this problem by providing two different versions of `applyGenericArguments`, one emitting diagnostics, the other expecting valid parameters.
@DougGregor would you mind taking a look? |
bool isGenericSignature, | ||
GenericTypeResolver *resolver); | ||
|
||
/// Apply generic arguments to the given type. | ||
/// | ||
/// This functions requires a valid unbound generic type with the correct |
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.
function
b0e075d
to
7822c92
Compare
I'd usually grumble about trailing whitespace changes, but it's fine; we should clean those up anyway. Thanks! |
Oh, I suspect this means that Sema could properly distinguish between "X<>" and "X" now, perhaps with some minor parser tweaks. |
[Sema] Highlight angle brackets <…> in diagnostics
Move the checks for invalid generic arguments into
applyGenericTypeReprArgs
so we can pass theGenericIdentTypeRepr
into it to access the angle bracket range whileresolveDictionaryType
can still useapplyUnboundGenericArguments
without anGenericIdentTypeRepr
.Edit:
check-swift
passed