We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ce37dd commit 74600dbCopy full SHA for 74600db
test/Constraints/generics.swift
@@ -846,3 +846,15 @@ func test_dictionary_with_generic_mismatch_in_key_or_value() {
846
let _: [S<Bool>: Int] = [S<Int>(): 42]
847
// expected-error@-1 {{cannot convert value of type 'S<Int>' to expected dictionary key type 'S<Bool>'}}
848
}
849
+
850
851
+// rdar://problem/56212087 - unable to infer type for generic parameter `T`
852
+func rdar56212087() {
853
+ func setValue(_: Any?, forKey: String) {}
854
855
+ func foo<T: ExpressibleByStringLiteral>(_: String, _: T) -> T {
856
+ fatalError()
857
+ }
858
859
+ setValue(foo("", ""), forKey: "") // Ok (T is inferred as a `String` instead of `Any?`)
860
+}
0 commit comments