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.
2 parents f6d49ba + 40a32dc commit d448a77Copy full SHA for d448a77
test/Constraints/generics.swift
@@ -858,3 +858,15 @@ func rdar56212087() {
858
859
setValue(foo("", ""), forKey: "") // Ok (T is inferred as a `String` instead of `Any?`)
860
}
861
+
862
+// rdar://77233864 - Ternary operator fails to deduce non-default literal type in SwiftUI preview
863
+func test_ternary_operator_with_regular_conformance_to_literal_protocol() {
864
+ // Note that in this case `ExpressibleByIntegerLiteral` is a non-literal requirement
865
+ func test<T: ExpressibleByIntegerLiteral>(_: T) -> T {
866
+ fatalError()
867
+ }
868
869
+ func bug(_: Float?) {}
870
871
+ bug(true ? test(0) : test(42)) // Ok - type is `CGFloat` for 0 and 42
872
+}
0 commit comments