-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
SwiftUI: Failed to produce diagnostic for expression when using keyword 'open' in some contexts #61039
Comments
No ambiguity logic for |
@xedin / @AnthonyLatsis - is this still a problem? If so, is it open for me to take a shot at? |
Please feel free to take it, I don’t think anybody is working on this at the moment. |
@dfperry5 Issues that are not assigned to anyone and show no signs of recent activity are yours for the taking. In other cases, the etiquette is to first ask the assignee or last person to have claimed it whether they’re (still) working on it. Note that an assignee need not imply that the person ever worked on the issue: some contributors like myself use assignments to simply bookmark issues. Please let us know if you want to be assigned to this. |
@AnthonyLatsis - Please assign this one to me! Sorry for the delay, took a vacation and we're just getting back :) |
A more illuminating reproduction: func `open`(_: Int) {}
func `open`(_: Bool) {}
func degrees(_: Int) {}
do {
degrees(open)
} And a reduced version of the original example: import SwiftUI
struct MyView: View {
var body: some View {
Color.black.rotationEffect(.degrees(open))
}
} |
@AnthonyLatsis - been taking a peak at this and am feeling a little stuck. I see where it calls " DE.diagnose(expr->getLoc(), diag::type_of_expression_is_ambiguous) Any thoughts or suggestions would be much appreciated :) |
Hi Dylan, The overloaded name is irrelevant, you can try |
@AnthonyLatsis / @xedin - sorry to bug ya'll (and for the radio silence for a while). But, I am struggling with this issue still. In my debugging I am seeing "[fix: allow argument to parameter type conversion mismatch]" which leads me to believe we are trying to apply the AllowArgumentMismatch subclass of ContextualMismatch. This type did not have a diagnoseForAmbiguity override. I created the function, AllowArgumentMismatch::diagnoseForAmbiguity, and can see it being called. I'm fuzzy on the logic that should be applied within that function though. Will continue playing around - but if you get time - some guidance would be appreciated! :) |
I don't think we should not add |
@xedin just to make sure I'm following - the thought here is that |
Yes, that is correct. |
I got to admit I am pretty stuck here - I can see the it flowing through diagnoseAmbiguityWithFixes - but I'm not sure how to catch the specific error here. |
Describe the bug
Xcode/Swift/VSCode fail to notice that the variable has not been defined in some contexts.
Steps To Reproduce
Expected behavior
A notice that the variable was not defined rather than "failed to produce diagnostic for expression; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project sourcekitd".
Or, a notice that the use of 'open' is incorrect as it's a keyword.
Screenshots
N/A
Environment (please fill out the following information)
Additional context
Placing the 'open ? 45 : 0' inside of another context, say a print(), correctly identifies the issue of an undefined variable.
The text was updated successfully, but these errors were encountered: