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
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -910,3 +910,18 @@ let _ = SR_2164<Int, Bool>(a: 0) // Ok
910
910
let _ =SR_2164<Int,Bool>(b:true) // Ok
911
911
SR_2164<Int,Bool,Float>(a:0) // expected-error {{generic type 'SR_2164' specialized with too many type parameters (got 3, but expected 2)}}
912
912
SR_2164<Int,Bool,Float>(b:0) // expected-error {{generic type 'SR_2164' specialized with too many type parameters (got 3, but expected 2)}}
913
+
914
+
// <rdar://problem/29850459> Swift compiler misreports type error in ternary expression
915
+
916
+
letr29850459_flag=true
917
+
letr29850459_a:Int=0
918
+
letr29850459_b:Int=1
919
+
func r29850459()->Bool{returnfalse}
920
+
let _ =(r29850459_flag ? r29850459_a : r29850459_b)+42.0 // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'Double'}}
921
+
// expected-note@-1 {{overloads for '+' exist with these partially matching parameter lists: (Int, Int), (Double, Double), (Int, UnsafeMutablePointer<Pointee>), (Int, UnsafePointer<Pointee>)}}
922
+
let _ =({true}()? r29850459_a : r29850459_b)+42.0 // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'Double'}}
923
+
// expected-note@-1 {{overloads for '+' exist with these partially matching parameter lists: (Int, Int), (Double, Double), (Int, UnsafeMutablePointer<Pointee>), (Int, UnsafePointer<Pointee>)}}
924
+
let _ =(r29850459()? r29850459_a : r29850459_b)+42.0 // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'Double'}}
925
+
// expected-note@-1 {{overloads for '+' exist with these partially matching parameter lists: (Int, Int), (Double, Double), (Int, UnsafeMutablePointer<Pointee>), (Int, UnsafePointer<Pointee>)}}
926
+
let _ =((r29850459_flag || r29850459())? r29850459_a : r29850459_b)+42.0 // expected-error {{binary operator '+' cannot be applied to operands of type 'Int' and 'Double'}}
927
+
// expected-note@-1 {{overloads for '+' exist with these partially matching parameter lists: (Int, Int), (Double, Double), (Int, UnsafeMutablePointer<Pointee>), (Int, UnsafePointer<Pointee>)}}
0 commit comments