-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Typechecker] Fix duplicate diagnostics when using attributes #28888
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
… after emitting a diagnostic, to prevent duplicate diagnostics later
@swift-ci please smoke test |
@swift-ci please smoke test |
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.
So seeing a pattern here - should we add a special diagnose
method to TypeResolver
just like we have for FailureDiagnostic
which would also take repr
and invalidate it internally?
…pts a TypeRepr and invalidates it
@xedin Sure thing, I have done that now! |
@swift-ci please smoke test |
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.
LGTM!
I have added @rintaro as a reviewer as well since he spend some time on type resolution as well. |
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.
No objection to this. Thanks!
…ang#28888) * [Typechecker] resolveAttributedType() should invalidate the type repr after emitting a diagnostic, to prevent duplicate diagnostics later * [Test] Update '@NoEscape' attribute diagnostics * [Typechecker] Add a special diagnose method to TypeResolver that accepts a TypeRepr and invalidates it * [Typechecker] Rename the special 'diagnose' method to 'diagnoseInvalid' for clarity
We were not invalidating the
TypeRepr
after diagnosing inresolveAttributedType
, which meant that trying to resolving the type for the sameTypeRepr
would result in the same diagnostic multiple times.It seems to affect just
@autoclosure
and@escaping
in some cases (and@noescape
which is not supported anymore), but I've applied the invalidation in all cases to future proof this.Resolves SR-9178