- Notifications
You must be signed in to change notification settings - Fork 10.6k
Fix "failed to produce diagnostic" with invalid leading dot usage when prepared overloads are enabled #85011
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
Fix "failed to produce diagnostic" with invalid leading dot usage when prepared overloads are enabled #85011
Conversation
5133c97
to 6fad36c
Compare @swift-ci Please smoke test |
test/Constraints/operator.swift Outdated
func ?= (pattern: I60954?, version: Self) { // expected-error{{operator '?=' declared in type 'I60954' must be 'static'}} | ||
// expected-error@+2{{operator is not a known binary operator}} | ||
// expected-error@+1{{initializer 'init(_:)' requires that 'I60954' conform to 'StringProtocol'}} | ||
// expected-error@+1{{contextual member reference to initializer 'init(_:)' requires 'Self' constraint in the protocol extension}} |
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.
I think this is OK, the original bug report this test case came from was that the code just crashes the compiler.
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.
The code is not crashing but it’s a diagnostic regression and it’s hard to say what even does it reference because there are no protocols involved here…
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.
Perhaps, but this was the only regression, and it's in a file about operators even though it doesn't concern operators :) I'd really like to land this soon though, it's not worth holding up any longer.
However, I have what appears to be a simple fix. It also seems to improve a diagnostic in one case in static_members_on_protocol_in_generic_context.swift
. I'll push a new version of this commit later tonight!
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.
Thanks! Leading-dot references are very common in SwiftUI and it would be great to avoid diagnostic regressions with them if possible.
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.
This is also about inferring a base type from an operator reference so related to operators :)
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.
Leading-dot references are very common in SwiftUI and it would be great to avoid diagnostic regressions with them if possible.
We should probably go through the bug tracker to collect more test cases (fixed and unfixed) then. ;-)
…rotocol_in_generic_context.swift It looks like we didn't test leading dot with instance members.
Tests still pass without this code, including the tests I just added in the previous commit.
6fad36c
to 1b6ac2c
Compare @xedin Please take a look at the new version. It's a bit of a hack because if the overload hasn't been resolved yet, I conservatively assume it's a |
@swift-ci Please smoke test |
Why can’t we delay and re-active the constraint in this case anymore? I am just wondering what is the interaction between that and prepared overloads… |
Because we’re simplifying an existing constraint, so |
Can we return |
I already tried that, it didn’t work. |
@swift-ci Please smoke test macOS |
Okay sounds good, I think the workaround looks okay! |
@xedin We can certainly revisit it later, I'd like to clean up |
@swift-ci Please clean smoke test macOS |
No description provided.