-
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
Offer additional note for why method with Self reference cannot be used on any SomeType
#76320
Comments
@GunjanRawat26 This could be a good intro to diagnostics |
Linking with radar rdar://135445764 Contributions welcome here, this could be an simple first issue maybe? |
hey @ktoso , i would like to work on this as my first issue from what i have understood is we need to give a more refined compiler message for this error and for it
it would be great if you could guide me further on anything that i am missing |
Current progress : ERROR(could_not_use_member_on_existential,none,
"member %1 cannot be used on value of type %0; consider using a"
" generic constraint instead",
(Type, DeclNameRef))
// error: member 'take' cannot be used on value of type 'any Alpha'; consider using a generic constraint instead This is where changes will be made to show different error message Questions
|
protocol Base { protocol Alpha: Base { struct Use<A: Alpha> where A.SomeID == Int {
} |
@flash1729 I know you asked the original developer for help, and I’m sure they’ll provide guidance when they’re available. In the meantime, I’m very new myself, but I’ll try my best to give some direction. Based on the Proposed Solution in the issue submission, it seems like adding a note instead of modifying the existing error would be a good approach. Here's what I would try:
I hope this helps! Let me know if I’m overstepping or if anything needs more explanation. |
That's good hints, thanks @jameesbrown |
@jameesbrown Thanks for hints. I will look into them...
I faced issues in determining which schema to use (i used diagnostics_database) Also unknowingly i used two build methods (ninja (for complete build) and xcode(after minor changes)) which led to some errors cause xcode build couldn't find some files in expected location of llvm clone. Now i will go through suggested sources and instead of modifying error message add a related note accordingly... |
You may have already looked at it, but https://github.com/swiftlang/swift/blob/main/docs/HowToGuides/GettingStarted.md#using-ninja-with-xcode is the best. Also one thing to be careful about is when selecting the executable for your scheme (Edit Scheme...>Run), make sure you are selecting one in |
Hi, would like to work on this. Could you assign this to me. |
@flash1729 Are you still working on this? |
Yes. Due to some other commitments I was unable to submit a final pr. |
Motivation
The following snippet;
is correct in rejecting the line, since we need
Self.SomeID
to be well typed, but we dont know what its type is via theany
.It'd be helpful if we can point out that "why" the method can't be used via a note, in a method with many parameters one can sometimes miss the Self reference.
Proposed solution
Adding a
note
on the offending parameter would be goodAlternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: