Skip to content

Commit b4b77fb

Browse files
committed
[AST] Fix argument to diagnostic
A simple “%1” to “%0” for a diagnosis with just one arg, along with a test case for it.
1 parent 6964301 commit b4b77fb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/swift/AST/DiagnosticsSema.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ ERROR(cannot_throw_nil,none,
257257
ERROR(cannot_convert_raw_initializer_value,none,
258258
"cannot convert value of type %0 to raw type %1", (Type,Type))
259259
ERROR(cannot_convert_raw_initializer_value_nil,none,
260-
"cannot convert nil to raw type %1", (Type))
260+
"cannot convert nil to raw type %0", (Type))
261261

262262
ERROR(cannot_convert_default_arg_value,none,
263263
"default argument value of type %0 cannot be converted to type %1",

test/Parse/enum.swift

+4
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,7 @@ public protocol RawValueB
429429
enum RawValueBTest: Double, RawValueB {
430430
case A, B
431431
}
432+
433+
enum foo : String {
434+
case bar = nil // expected-error {{cannot convert nil to raw type 'String'}}
435+
}

0 commit comments

Comments
 (0)