Skip to content

Commit e92c6eb

Browse files
committed
[Diagnostics] NFC: Use non-initializer diagnostic when raw representable type doesn't conform but .rawValue does
1 parent b694698 commit e92c6eb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6842,7 +6842,7 @@ AbstractRawRepresentableFailure::getDiagnostic() const {
68426842
} else if (locator->isLastElement<LocatorPathElt::ApplyArgToParam>()) {
68436843
return diag::cannot_convert_argument_value;
68446844
} else if (locator->isLastElement<LocatorPathElt::AnyRequirement>()) {
6845-
return diag::cannot_convert_initializer_value_protocol;
6845+
return diag::type_does_not_conform;
68466846
}
68476847

68486848
return None;

test/ClangImporter/newtype_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func acceptComparable<T: Comparable>(_: T) {}
2020
func testNewTypeWrapper(x: NSNotification.Name, y: NSNotification.Name) {
2121
acceptEquatable(x)
2222
acceptHashable(x)
23-
acceptComparable(x) // expected-error {{value of type 'NSNotification.Name' does not conform to specified type 'Comparable'}} {{19-19=.rawValue}}
23+
acceptComparable(x) // expected-error {{type 'NSNotification.Name' does not conform to protocol 'Comparable'}} {{19-19=.rawValue}}
2424

2525
_ = x == y
2626
_ = x != y

0 commit comments

Comments
 (0)