You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Constraints/diagnostics.swift
+22-1Lines changed: 22 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -425,7 +425,7 @@ enum Color {
425
425
}
426
426
427
427
// FIXME: This used to be better: "'map' produces '[T]', not the expected contextual result type '(Int, Color)'"
428
-
let _:(Int,Color)=[1,2].map({($0,.Unknown(""))}) // expected-error {{expression type '((Int) throws -> _) throws -> [_]' is ambiguous without more context}}
428
+
let _:(Int,Color)=[1,2].map({($0,.Unknown(""))}) // expected-error {{expression type '((Int) throws -> _) throws -> Array<_>' is ambiguous without more context}}
429
429
430
430
let _:[(Int,Color)]=[1,2].map({($0,.Unknown(""))})// expected-error {{missing argument label 'description:' in call}}
431
431
@@ -1234,3 +1234,24 @@ let baz: (Swift.Error) = Error() //expected-error {{value of type 'diagnostics.E
1234
1234
letbaz2:Swift.Error=(Error()) //expected-error {{value of type 'diagnostics.Error' does not conform to specified type 'Swift.Error'}}
1235
1235
letbaz3:(Swift.Error)=(Error()) //expected-error {{value of type 'diagnostics.Error' does not conform to specified type 'Swift.Error'}}
1236
1236
letbaz4:((Swift.Error))=(Error()) //expected-error {{value of type 'diagnostics.Error' does not conform to specified type 'Swift.Error'}}
1237
+
1238
+
// SyntaxSugarTypes with unresolved types
1239
+
func takesGenericArray<T>(_ x:[T]){}
1240
+
takesGenericArray(1) // expected-error {{cannot convert value of type 'Int' to expected argument type 'Array<_>'}}
1241
+
func takesNestedGenericArray<T>(_ x:[[T]]){}
1242
+
takesNestedGenericArray(1) // expected-error {{cannot convert value of type 'Int' to expected argument type 'Array<Array<_>>'}}
1243
+
func takesSetOfGenericArrays<T>(_ x:Set<[T]>){}
1244
+
takesSetOfGenericArrays(1) // expected-error {{cannot convert value of type 'Int' to expected argument type 'Set<Array<_>>'}}
0 commit comments