Skip to content

Commit 97e6a50

Browse files
committed
Start using contextual information from function calls to diagnose issues in their
argument. For now we start with some of the most simple cases: single argument calls. This dramatically improves the QoI for error messages in argument lists, typically turning a error+note combo into a single specific error message. Some minor improvements coming (and also generalizing this to n-ary calls), but it is nice that all the infrastructure is starting to come together... Swift SVN r30905
1 parent 7a91af8 commit 97e6a50

33 files changed

+151
-179
lines changed

lib/Sema/CSDiag.cpp

+19-4
Original file line numberDiff line numberDiff line change
@@ -2722,7 +2722,12 @@ Expr *FailureDiagnosis::typeCheckChildIndependently(Expr *subExpr,
27222722

27232723
// If we have a conversion type, but it has type variables (from the current
27242724
// ConstraintSystem), then we can't use it.
2725-
if (convertType && convertType->hasTypeVariable()) {
2725+
if (convertType &&
2726+
(convertType->hasTypeVariable() ||
2727+
// If the contextual type has an archetype, we need to open it, but
2728+
// don't know how yet.
2729+
// FIXME: implement opening of archetypes.
2730+
convertType->hasArchetype())) {
27262731
convertType = Type();
27272732
convertTypePurpose = CTP_Unused;
27282733
}
@@ -3047,9 +3052,6 @@ typeCheckArgumentChildIndependently(Expr *argExpr, Type argType,
30473052
argType = candidates[0].getArgumentType();
30483053
}
30493054

3050-
// TODO: Don't disable all type information.
3051-
argType = Type();
3052-
30533055
auto CTPurpose = argType ? CTP_CallArgument : CTP_Unused;
30543056

30553057
// FIXME: This should all just be a matter of getting type type of the
@@ -3063,6 +3065,19 @@ typeCheckArgumentChildIndependently(Expr *argExpr, Type argType,
30633065
if (exampleInputType && exampleInputType->is<InOutType>())
30643066
options |= TCC_AllowLValue;
30653067

3068+
// If the argtype is a tuple type with default arguments, we need to get
3069+
// the scalar element or punt it, since type checking the subexpression
3070+
// won't be able to find the default argument provider.
3071+
if (argType)
3072+
if (auto argTT = argType->getAs<TupleType>())
3073+
if (argTT->hasAnyDefaultValues()) {
3074+
int scalarElt = argTT->getElementForScalarInit();
3075+
if (scalarElt == -1)
3076+
argType = Type();
3077+
else
3078+
argType = argTT->getElementType(scalarElt);
3079+
}
3080+
30663081
return typeCheckChildIndependently(unwrapParenExpr(argExpr), argType,
30673082
CTPurpose, options);
30683083
}

test/ClangModules/attr-swift_private.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func testCF(a: __PrivCFTypeRef, b: __PrivCFSubRef, c: __PrivInt) {
110110
makeSureAnyObject(a)
111111
makeSureAnyObject(b)
112112
#if !IRGEN
113-
makeSureAnyObject(c) // expected-error {{cannot invoke 'makeSureAnyObject' with an argument list of type '(__PrivInt)'}} expected-note {{expected an argument list of type '(AnyObject)'}}
113+
makeSureAnyObject(c) // expected-error {{type '__PrivInt' (aka 'Int32') does not conform to protocol 'AnyObject'}}
114114
#endif
115115
}
116116

test/ClangModules/cf.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func test0(fridge: CCRefrigeratorRef) {
1313

1414
func test1(power: Unmanaged<CCPowerSupplyRef>) {
1515
assertUnmanaged(power)
16-
let fridge = CCRefrigeratorCreate(power) // expected-error {{cannot invoke 'CCRefrigeratorCreate' with an argument list of type '(Unmanaged<CCPowerSupplyRef>)'}} expected-note{{expected an argument list of type '(CCPowerSupply!)'}}
16+
let fridge = CCRefrigeratorCreate(power) // expected-error {{cannot convert value of type 'Unmanaged<CCPowerSupplyRef>' (aka 'Unmanaged<CCPowerSupply>') to expected argument type 'CCPowerSupply!'}}
1717
assertUnmanaged(fridge)
1818
}
1919

@@ -111,8 +111,7 @@ func testOutParametersGood() {
111111

112112
func testOutParametersBad() {
113113
let fridge: CCRefrigerator?
114-
CCRefrigeratorCreateIndirect(fridge) // expected-error {{cannot invoke 'CCRefrigeratorCreateIndirect' with an argument list of type '(CCRefrigerator?)'}}
115-
// expected-note @-1 {{expected an argument list of type '(UnsafeMutablePointer<CCRefrigerator?>)'}}
114+
CCRefrigeratorCreateIndirect(fridge) // expected-error {{cannot convert value of type 'CCRefrigerator?' to expected argument type 'UnsafeMutablePointer<CCRefrigerator?>' (aka 'UnsafeMutablePointer<Optional<CCRefrigerator>>')}}
116115

117116
let power: CCPowerSupply?
118117
CCRefrigeratorGetPowerSupplyIndirect(0, power) // expected-error {{cannot invoke 'CCRefrigeratorGetPowerSupplyIndirect' with an argument list of type '(Int, CCPowerSupply?)'}}

test/ClangModules/cfuncs_parse.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import cfuncs
66

77
func test_cfunc1(i: Int) {
88
cfunc1() // okay
9-
cfunc1(i) // expected-error{{cannot invoke 'cfunc1' with an argument list of type '(Int)'}}
10-
// expected-note @-1 {{expected an argument list of type '()'}}
9+
cfunc1(i) // expected-error{{cannot convert value of type 'Int' to expected argument type '()'}}
1110
}
1211

1312
func test_cfunc2(i: Int) {

test/ClangModules/nullability.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ func testSomeClass(sc: SomeClass, osc: SomeClass?) {
4545
// Nullability with CF types.
4646
func testCF(fridge: CCRefrigerator) {
4747
CCRefrigeratorOpenDoSomething(fridge) // okay
48-
CCRefrigeratorOpenDoSomething(nil) // expected-error{{cannot invoke 'CCRefrigeratorOpenDoSomething' with an argument list of type '(NilLiteralConvertible)'}}
49-
// expected-note@-1{{expected an argument list of type '(CCRefrigerator)'}}
48+
CCRefrigeratorOpenDoSomething(nil) // expected-error{{nil cannot be used in context expecting type 'CCRefrigerator'}}
5049

5150
CCRefrigeratorOpenMaybeDoSomething(fridge) // okay
5251
CCRefrigeratorOpenMaybeDoSomething(nil) // okay
5352

54-
CCRefrigeratorOpenMaybeDoSomething(5) // expected-error{{cannot invoke}}
55-
// expected-note@-1{{argument list of type '(CCRefrigerator?)'}}
53+
CCRefrigeratorOpenMaybeDoSomething(5) // expected-error{{cannot convert value of type 'Int' to expected argument type 'CCRefrigerator?'}}
5654
}

test/ClangModules/objc_parse.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ func instanceMethods(b: B) {
5050
// Both class and instance methods exist.
5151
b.description
5252
b.instanceTakesObjectClassTakesFloat(b)
53-
b.instanceTakesObjectClassTakesFloat(2.0) // expected-error{{cannot invoke 'instanceTakesObjectClassTakesFloat' with an argument list of type '(Double)'}}
54-
// expected-note @-1 {{expected an argument list of type '(AnyObject!)'}}
53+
b.instanceTakesObjectClassTakesFloat(2.0) // expected-error{{cannot convert value of type 'Double' to expected argument type 'AnyObject!'}}
5554

5655
// Instance methods with keyword components
5756
var obj = NSObject()
@@ -71,8 +70,7 @@ func classMethods(b: B, other: NSObject) {
7170
// Both class and instance methods exist.
7271
B.description()
7372
B.instanceTakesObjectClassTakesFloat(2.0)
74-
B.instanceTakesObjectClassTakesFloat(other) // expected-error{{cannot invoke 'instanceTakesObjectClassTakesFloat' with an argument list of type '(NSObject)'}}
75-
// expected-note @-1 {{expected an argument list of type '(Float)'}}
73+
B.instanceTakesObjectClassTakesFloat(other) // expected-error{{cannot convert value of type 'NSObject' to expected argument type 'Float'}}
7674

7775
// Call an instance method of NSObject.
7876
var c: AnyClass = B.myClass() // no-warning

test/ClangModules/protocol_metatype_object_conversion.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ func takesProtocol(x: Protocol) {}
1313

1414
takesProtocol(ObjCProto.self)
1515
takesProtocol(ObjCProto2.self)
16-
takesProtocol(NonObjCProto.self) // expected-error{{cannot invoke 'takesProtocol' with an argument list of type '(NonObjCProto.Protocol)'}} expected-note{{expected an argument list of type '(Protocol)'}}
17-
takesProtocol(TwoObjCProtos.self) // expected-error{{cannot invoke 'takesProtocol' with an argument list of type '(TwoObjCProtos.Protocol)'}} expected-note {{expected an argument list of type '(Protocol)'}}
16+
takesProtocol(NonObjCProto.self) // expected-error{{cannot convert value of type 'NonObjCProto.Protocol' to expected argument type 'Protocol'}}
17+
takesProtocol(TwoObjCProtos.self) // expected-error{{cannot convert value of type 'TwoObjCProtos.Protocol' (aka 'protocol<ObjCProto, ObjCProto2>.Protocol') to expected argument type 'Protocol'}}

test/Constraints/array_literal.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ func useList<T>(l: List<T>) {}
4343
func useDict<K,V>(d: Dict<K,V>) {}
4444

4545
useIntList([1,2,3])
46-
useIntList([1.0,2,3]) // expected-error{{cannot invoke 'useIntList' with an argument list of type '([Double])'}} expected-note{{expected an argument list of type '(IntList)'}}
46+
useIntList([1.0,2,3]) // expected-error{{cannot convert value of type '[Double]' to expected argument type 'IntList'}}
4747
useDoubleList([1.0,2,3])
4848
useDoubleList([1.0,2.0,3.0])
4949

5050
useIntDict(["Niners" => 31, "Ravens" => 34])
51-
useIntDict(["Niners" => 31, "Ravens" => 34.0]) // expected-error{{cannot invoke 'useIntDict' with an argument list of type '([(String, Double)])'}} expected-note{{expected an argument list of type '(IntDict)'}}
51+
useIntDict(["Niners" => 31, "Ravens" => 34.0]) // expected-error{{cannot convert value of type '[(String, Double)]' to expected argument type 'IntDict'}}
5252
useDoubleDict(["Niners" => 31, "Ravens" => 34.0])
5353
useDoubleDict(["Niners" => 31.0, "Ravens" => 34])
5454
useDoubleDict(["Niners" => 31.0, "Ravens" => 34.0])

test/Constraints/casts_objc.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ func nsobject_as_class_cast<T>(x: NSObject, _: T) {
3434
func test(a : CFString!, b : CFString) {
3535
var dict = NSMutableDictionary()
3636
let object = NSObject()
37-
dict[a] = object // expected-error {{cannot subscript a value of type 'NSMutableDictionary' with an index of type 'CFString!'}}
38-
// expected-note @-1 {{expected an argument list of type '(NSCopying)'}}
37+
dict[a] = object // expected-error {{cannot convert value of type 'CFString!' to expected argument type 'NSCopying'}}
3938

4039

4140
dict[b] = object // expected-error {{type 'CFString' does not conform to protocol 'NSCopying'}}

test/Constraints/class.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func ternary<T>(cond: Bool,
2222
@autoclosure _ ifFalse: () -> T) -> T {}
2323

2424
f0(c)
25-
f0(a) // expected-error{{cannot invoke 'f0' with an argument list of type '(A)'}} expected-note {{expected an argument list of type '(B)'}}
25+
f0(a) // expected-error{{cannot convert value of type 'A' to expected argument type 'B'}}
2626
f0(ef)
2727
f0(fi)
2828

test/Constraints/diagnostics.swift

+26-46
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ var d : Double
3737
// Check the various forms of diagnostics the type checker can emit.
3838

3939
// Tuple size mismatch.
40-
f1( // expected-error {{cannot invoke 'f1' with an argument list of type '((Int) -> Int)'}}
41-
f4 // expected-note @-1 {{expected an argument list of type '((Int, Float) -> Int)'}}
40+
f1(
41+
f4 // expected-error {{cannot convert value of type '(Int) -> Int' to expected argument type '(Int, Float) -> Int'}}
4242
)
4343

4444
// Tuple element unused.
@@ -56,12 +56,12 @@ f0(i, // expected-error {{cannot invoke 'f0' with an argument list of type '(Int
5656
)
5757

5858
// Function result not a subtype.
59-
f1( // expected-error {{cannot invoke 'f1' with an argument list of type '((Int, Float) -> ())'}}
60-
f0 // expected-note @-1 {{expected an argument list of type '((Int, Float) -> Int)'}}
59+
f1(
60+
f0 // expected-error {{cannot convert value of type '(Int, Float) -> ()' to expected argument type '(Int, Float) -> Int'}}
6161
)
6262

63-
f3( // expected-error {{cannot invoke 'f3' with an argument list of type '((((Int) -> Int)) -> Int)'}}
64-
f2 // expected-note @-1 {{expected an argument list of type '(((Int) -> Float) -> Int)'}}
63+
f3(
64+
f2 // expected-error {{cannot convert value of type '(((Int) -> Int)) -> Int' to expected argument type '((Int) -> Float) -> Int'}}
6565
)
6666

6767
// FIXME: Can't test same-type diagnostic yet.
@@ -83,10 +83,8 @@ i.wobble() // expected-error{{value of type 'Int' has no member 'wobble'}}
8383
// Make sure we don't leave open existentials when diagnosing.
8484
// <rdar://problem/20598568>
8585
func pancakes(p: P2) {
86-
f4(p.wonka) // expected-error{{cannot invoke 'f4' with an argument list of type '(() -> ())'}}
87-
// expected-note@-1{{expected an argument list of type '(Int)'}}
88-
f4(p.wonka()) // expected-error{{cannot invoke 'f4' with an argument list of type '()'}}
89-
// expected-note@-1{{expected an argument list of type '(Int)'}}
86+
f4(p.wonka) // expected-error{{cannot convert value of type '() -> ()' to expected argument type 'Int'}}
87+
f4(p.wonka()) // expected-error{{cannot convert value of type '()' to expected argument type 'Int'}}
9088
}
9189

9290
protocol Shoes {
@@ -263,7 +261,7 @@ _ = 4(1) // expected-error {{cannot call value of non-function type 'Int'}}
263261
// <rdar://problem/21784170> Incongruous `unexpected trailing closure` error in `init` function which is cast and called without trailing closure.
264262
func rdar21784170() {
265263
let initial = (1.0 as Double, 2.0 as Double)
266-
(Array.init as (Double...) -> Array<Double>)(initial as (Double, Double)) // expected-error {{cannot invoke value of type '(Double...) -> Array<Double>' with argument list '(Double, Double)'}}
264+
(Array.init as (Double...) -> Array<Double>)(initial as (Double, Double)) // expected-error {{cannot invoke value of type '(Double...) -> Array<Double>' with argument list '(Double...)'}}
267265
}
268266

269267
// <rdar://problem/21829141> BOGUS: unexpected trailing closure
@@ -295,9 +293,8 @@ func r20789423() {
295293
}
296294

297295
let p: C
298-
print(p.f(p)()) // expected-error {{cannot invoke 'f' with an argument list of type '(C)'}}
299-
// expected-note @-1 {{expected an argument list of type '(Int)'}}
300-
296+
print(p.f(p)()) // expected-error {{cannot convert value of type 'C' to expected argument type 'Int'}}
297+
301298
let _f = { (v: Int) in // expected-error {{unable to infer closure type in the current context}}
302299
// expected-note @-1 {{multi-statement closures require an explicit return type}}
303300
print("a")
@@ -313,17 +310,14 @@ func f7(a: Int)(b : Int) -> Int {
313310
}
314311

315312
f7(1)(b: 1)
316-
f7(1.0)(2) // expected-error {{cannot invoke 'f7' with an argument list of type '(Double)'}}
317-
// expected-note @-1 {{expected an argument list of type '(Int)'}}
313+
f7(1.0)(2) // expected-error {{cannot convert value of type 'Double' to expected argument type 'Int'}}
318314

319-
f7(1)(1.0) // expected-error {{cannot invoke 'f7' with an argument list of type '(Double)'}}
320-
// expected-note @-1 {{expected an argument list of type '(b: Int)'}}
315+
f7(1)(1.0) // expected-error {{cannot convert value of type 'Double' to expected argument type '(b: Int)'}}
321316

322317
let f8 = f7(2)
323318
f8(b: 1)
324319
f8(10) // expected-error {{missing argument label 'b:' in call}}
325-
f8(1.0) // expected-error {{cannot invoke 'f8' with an argument list of type '(Double)'}}
326-
// expected-note @-1 {{expected an argument list of type '(b: Int)'}}
320+
f8(1.0) // expected-error {{cannot convert value of type 'Double' to expected argument type '(b: Int)'}}
327321

328322
class CurriedClass {
329323
func method1() {}
@@ -333,35 +327,28 @@ class CurriedClass {
333327

334328
let c = CurriedClass()
335329
_ = c.method1
336-
c.method1(1) // expected-error {{cannot invoke 'method1' with an argument list of type '(Int)'}}
337-
// expected-note @-1 {{expected an argument list of type '()'}}
330+
c.method1(1) // expected-error {{cannot convert value of type 'Int' to expected argument type '()'}}
338331
_ = c.method2(1)
339-
_ = c.method2(1.0) // expected-error {{cannot invoke 'method2' with an argument list of type '(Double)'}}
340-
// expected-note @-1 {{expected an argument list of type '(Int)'}}
332+
_ = c.method2(1.0) // expected-error {{cannot convert value of type 'Double' to expected argument type 'Int'}}
341333
c.method2(1)(b: 2)
342334
c.method2(1)(c: 2) // expected-error {{incorrect argument label in call (have 'c:', expected 'b:')}}
343335
c.method2(1)(c: 2.0) // expected-error {{cannot invoke 'method2' with an argument list of type '(c: Double)'}}
344336
// expected-note @-1 {{expected an argument list of type '(b: Int)'}}
345337
c.method2(1)(b: 2.0) // expected-error {{cannot invoke 'method2' with an argument list of type '(b: Double)'}}
346338
// expected-note @-1 {{expected an argument list of type '(b: Int)'}}
347-
c.method2(1.0)(b: 2) // expected-error {{cannot invoke 'method2' with an argument list of type '(Double)'}}
348-
// expected-note @-1 {{expected an argument list of type '(Int)'}}
349-
c.method2(1.0)(b: 2.0) // expected-error {{cannot invoke 'method2' with an argument list of type '(Double)'}}
350-
// expected-note @-1 {{expected an argument list of type '(Int)'}}
339+
c.method2(1.0)(b: 2) // expected-error {{cannot convert value of type 'Double' to expected argument type 'Int'}}
340+
c.method2(1.0)(b: 2.0) // expected-error {{cannot convert value of type 'Double' to expected argument type 'Int'}}
351341

352342
CurriedClass.method1(c)()
353343
_ = CurriedClass.method1(c)
354-
CurriedClass.method1(c)(1) // expected-error {{cannot invoke 'method1' with an argument list of type '(Int)'}}
355-
// expected-note @-1 {{expected an argument list of type '()'}}
356-
CurriedClass.method1(2.0)(1) // expected-error {{cannot invoke 'method1' with an argument list of type '(Double)'}}
357-
// expected-note @-1 {{expected an argument list of type '(CurriedClass)'}}
344+
CurriedClass.method1(c)(1) // expected-error {{cannot convert value of type 'Int' to expected argument type '()'}}
345+
CurriedClass.method1(2.0)(1) // expected-error {{cannot convert value of type 'Double' to expected argument type 'CurriedClass'}}
358346

359347
CurriedClass.method2(c)(32)(b: 1)
360348
_ = CurriedClass.method2(c)
361349
_ = CurriedClass.method2(c)(32)
362350
_ = CurriedClass.method2(1,2) // expected-error {{extra argument in call}}
363-
CurriedClass.method2(c)(1.0)(b: 1) // expected-error {{cannot invoke 'method2' with an argument list of type '(Double)'}}
364-
// expected-note @-1 {{expected an argument list of type '(Int)'}}
351+
CurriedClass.method2(c)(1.0)(b: 1) // expected-error {{cannot convert value of type 'Double' to expected argument type 'Int'}}
365352
CurriedClass.method2(c)(1)(b: 1.0) // expected-error {{cannot invoke 'method2' with an argument list of type '(b: Double)'}}
366353
// expected-note @-1 {{expected an argument list of type '(b: Int)'}}
367354
CurriedClass.method2(c)(2)(c: 1.0) // expected-error {{cannot invoke 'method2' with an argument list of type '(c: Double)'}}
@@ -375,8 +362,7 @@ _ = CurriedClass.method3(c)(1, b: 2)(32) // expected-error {{cannot call value o
375362
_ = CurriedClass.method3(1, 2) // expected-error {{extra argument in call}}
376363
CurriedClass.method3(c)(1.0, b: 1) // expected-error {{cannot invoke 'method3' with an argument list of type '(Double, b: Int)'}}
377364
// expected-note @-1 {{expected an argument list of type '(Int, b: Int)'}}
378-
CurriedClass.method3(c)(1) // expected-error {{cannot invoke 'method3' with an argument list of type '(Int)'}}
379-
// expected-note @-1 {{expected an argument list of type '(Int, b: Int)'}}
365+
CurriedClass.method3(c)(1) // expected-error {{cannot convert value of type 'Int' to expected argument type '(Int, b: Int)'}}
380366

381367
CurriedClass.method3(c)(c: 1.0) // expected-error {{missing argument for parameter 'b' in call}}
382368

@@ -385,10 +371,7 @@ extension CurriedClass {
385371
func f() {
386372
method3(1, b: 2)
387373
method3() // expected-error {{missing argument for parameter #1 in call}}
388-
389-
method3(42) // expected-error {{cannot invoke 'method3' with an argument list of type '(Int)'}}
390-
// expected-note @-1 {{expected an argument list of type '(Int, b: Int)'}}
391-
374+
method3(42) // expected-error {{cannot convert value of type 'Int' to expected argument type '(Int, b: Int)'}}
392375
method3(self) // expected-error {{missing argument for parameter 'b' in call}}
393376
}
394377
}
@@ -422,8 +405,7 @@ func someGeneric19997471<T>(x: T) {
422405
func f20371273() {
423406
let x: [Int] = [1, 2, 3, 4]
424407
let y: UInt = 4
425-
x.filter { $0 == y } // expected-error {{cannot invoke 'filter' with an argument list of type '((UInt) -> Bool)'}}
426-
// expected-note @-1 {{expected an argument list of type '(@noescape (Self.Generator.Element) throws -> Bool)'}}
408+
x.filter { $0 == y } // expected-error {{cannot convert value of type '(UInt) -> Bool' to expected argument type '@noescape (Int) throws -> Bool'}}
427409
}
428410

429411

@@ -500,12 +482,10 @@ class B {
500482

501483

502484
func test(a : B) {
503-
B.f1(nil) // expected-error {{cannot invoke 'f1' with an argument list of type '(NilLiteralConvertible)'}}
504-
// expected-note @-1 {{expected an argument list of type '(AOpts)'}}
485+
B.f1(nil) // expected-error {{nil cannot be used in context expecting type 'AOpts'}}
505486
a.function(42, nil) //expected-error {{cannot invoke 'function' with an argument list of type '(Int, NilLiteralConvertible)'}}
506487
// expected-note @-1 {{expected an argument list of type '(Int8, a: AOpts)'}}
507-
a.f2(nil) // expected-error {{cannot invoke 'f2' with an argument list of type '(NilLiteralConvertible)'}}
508-
// expected-note @-1 {{expected an argument list of type '(AOpts)'}}
488+
a.f2(nil) // expected-error {{nil cannot be used in context expecting type 'AOpts'}}
509489
}
510490

511491

test/Constraints/dictionary_literal.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func useDict<K, V>(d: Dictionary<K,V>) {}
1818
// Concrete dictionary literals.
1919
useDictStringInt([ "Hello" : 1 ])
2020
useDictStringInt([ "Hello" : 1, "World" : 2])
21-
useDictStringInt([ "Hello" : 1, "World" : 2.5]) // expected-error{{cannot invoke 'useDictStringInt' with an argument list of type '(Dictionary<String, Double>)'}} expected-note{{expected an argument list of type '(DictStringInt)'}}
21+
useDictStringInt([ "Hello" : 1, "World" : 2.5]) // expected-error{{cannot convert value of type 'Dictionary<String, Double>' to expected argument type 'DictStringInt'}}
2222
useDictStringInt([ 7 : 1, "World" : 2]) // expected-error{{type 'Int2048' does not conform to protocol 'IntegerLiteralConvertible'}}
2323

2424
// Generic dictionary literals.

0 commit comments

Comments
 (0)