Skip to content

Commit 2dfab70

Browse files
committed
fix <rdar://24314506> QoI: Fix-it for dictionary initializer on required class var suggests [] instead of [:]
a simple apparent typo or thinko
1 parent ebcabd7 commit 2dfab70

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6350,7 +6350,7 @@ static Optional<std::string> buildDefaultInitializerString(TypeChecker &tc,
63506350
return std::string(String); \
63516351
}
63526352
CHECK_LITERAL_PROTOCOL(ArrayLiteralConvertible, "[]")
6353-
CHECK_LITERAL_PROTOCOL(DictionaryLiteralConvertible, "[]")
6353+
CHECK_LITERAL_PROTOCOL(DictionaryLiteralConvertible, "[:]")
63546354
CHECK_LITERAL_PROTOCOL(UnicodeScalarLiteralConvertible, "\"\"")
63556355
CHECK_LITERAL_PROTOCOL(ExtendedGraphemeClusterLiteralConvertible, "\"\"")
63566356
CHECK_LITERAL_PROTOCOL(FloatLiteralConvertible, "0.0")

test/decl/var/properties.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,3 +1175,9 @@ _ = r19874152S5() // ok
11751175

11761176

11771177

1178+
// <rdar://problem/24314506> QoI: Fix-it for dictionary initializer on required class var suggests [] instead of [:]
1179+
class r24314506 { // expected-error {{class 'r24314506' has no initializers}}
1180+
var myDict: [String: AnyObject] // expected-note {{stored property 'myDict' without initial value prevents synthesized initializers}} {{34-34= = [:]}}
1181+
}
1182+
1183+

0 commit comments

Comments
 (0)