Skip to content

Commit bd1cc4c

Browse files
authored
Merge pull request swiftlang#65617 from zoecarver/update-diag-text
[diags][cxx-interop] Update diagnostic for 'begin' to suggest using a for-loop instead.
2 parents f358cbe + b2988f6 commit bd1cc4c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ NOTE(mark_safe_to_import, none, "annotate method '%0' with 'SWIFT_RETURNS_INDEPE
196196
NOTE(at_to_subscript, none, "do you want to replace it with a call "
197197
"to the subscript operator?",
198198
())
199-
NOTE(get_swift_iterator, none, "do you want to make a Swift iterator instead?",
199+
NOTE(use_collection_apis, none, "do you want to use a for-loop instead?",
200200
())
201201
NOTE(replace_with_nil, none, "do you want to compare against 'nil' instead?",
202202
())

lib/Sema/CSDiagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3877,7 +3877,7 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
38773877
if (conformsToRACollection(baseType)) {
38783878
ctx.Diags.diagnose(loc, diag::iterator_method_unavailable,
38793879
name.getBaseIdentifier().str());
3880-
ctx.Diags.diagnose(loc, diag::get_swift_iterator)
3880+
ctx.Diags.diagnose(loc, diag::use_collection_apis)
38813881
.fixItReplaceChars(
38823882
loc, loc.getAdvancedLoc(name.getBaseIdentifier().str().size()),
38833883
"makeIterator");

test/Interop/Cxx/class/fixits-for-std-vector.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import CxxStdlib
2222

2323
public func test(v: V) {
2424
// CHECK: note: C++ method 'begin' that returns an iterator is unavailable
25-
// CHECK: note: do you want to make a Swift iterator instead?
25+
// CHECK: note: do you want to use a for-loop instead?
2626
// CHECK: ^~~~~
2727
// CHECK: makeIterator
2828
_ = v.begin()

0 commit comments

Comments
 (0)