-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Offer fix-it to re-write ".at(42)" as "[42]". #63673
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
Merged
zoecarver
merged 10 commits into
swiftlang:main
from
zoecarver:fixits-for-common-swiftifications
Feb 22, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9ce9310
[cxx-interop] Offer fix-it to re-write ".at(42)" as "[42]".
zoecarver 4e0860b
[cxx-interp] Add fix-its for `front()`, `back()`, `begin()`, and `end…
zoecarver feeeccb
stash
zoecarver 5ac94a8
[cxx-interop] Completely overhaul diagnostics/notes for unsafe projec…
zoecarver d19b587
[cxx-interop] Update based on review feedback.
zoecarver 1b0ee8e
[cxx-interop] Fix two source locations; replace end with nil.
zoecarver c0416b1
[cxx-interop] Tests for the recent diganostics and fix-its.
zoecarver 256335c
[nfc] Require MacOS for the vector test.
zoecarver ffec6a2
[nfc] Add 'is' in diagnostic message.
zoecarver 38658a0
[cxx-interop] Fix test for linux; bail if we didn't load the overlay.
zoecarver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1255,7 +1255,18 @@ class MissingMemberFailure : public InvalidMemberRefFailure { | |
/// overload to be present, but a class marked as `@dynamicCallable` | ||
/// defines only `dynamicallyCall(withArguments:)` variant. | ||
bool diagnoseForDynamicCallable() const; | ||
|
||
|
||
/// Diagnose methods that return unsafe projections and suggest fixits. | ||
/// For example, if Swift cannot find "vector::data" because it is unsafe, try | ||
/// to diagnose this and tell the user why we did not import "vector::data". | ||
/// | ||
/// Provides fixits for: | ||
/// at -> subscript | ||
/// begin, end -> makeIterator | ||
/// front, back -> first, last | ||
void diagnoseUnsafeCxxMethod(SourceLoc loc, ASTNode anchor, Type baseType, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add a small comment there describing what this method is trying to do? |
||
DeclName name) const; | ||
|
||
/// Tailored diagnostics for collection literal with unresolved member expression | ||
/// that defaults the element type. e.g. _ = [.e] | ||
bool diagnoseInLiteralCollectionContext() const; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We usually use
DescriptiveDeclKind, Identifier
in cases like this instead of spelling outmethod
and quotes.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 it's important that we explicitly say that this is a C++ method, so I'm not sure
DescriptiveDeclKind
will work.