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
let _ ="" /* This is a comment */ ??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{13-43=}}
1553
1553
1554
1554
let _ ="" // This is a comment
1555
-
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1554:13-1555:10=}}
1555
+
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{-1:13-+0:10=}}
1556
1556
1557
1557
let _ ="" // This is a comment
1558
1558
/*
1559
1559
* The blank line below is part of the test case, do not delete it
1560
1560
*/
1561
-
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1557:13-1561:10=}}
1561
+
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{-4:13-+0:10=}}
1562
1562
1563
-
if(""?? // This is a comment // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{9-1564:9=}}
1563
+
if(""?? // This is a comment // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{9-+1:9=}}
1564
1564
"").isEmpty {}
1565
1565
1566
1566
if("" // This is a comment
1567
-
??"").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1566:9-1567:12=}}
1567
+
??"").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{-1:9-+0:12=}}
init<C>(_ data:Binding<C>, content:(Binding<C.Element>)->Content)where Data ==Array<C>, ID ==C.Element.ID, C :MutableCollection, C :RandomAccessCollection, C.Element :Idable, C.Index :Hashable{}
// ?? should have higher precedence than logical operators like || and comparisons.
786
786
if cond || (a ??42>0){} // Ok.
787
787
if(cond || a)??42>0{} // expected-error {{cannot be used as a boolean}} {{15-15=(}} {{16-16= != nil)}}
788
-
// expected-error@-1 {{binary operator '>' cannot be applied to operands of type 'Bool' and 'Int'}} expected-note@-1 {{overloads for '>' exist with these partially matching parameter list}}
788
+
// expected-error@-1 {{binary operator '>' cannot be applied to operands of type 'Bool' and 'Int'}}
789
789
// expected-error@-2 {{binary operator '??' cannot be applied to operands of type 'Bool' and 'Int'}}
790
+
// expected-note@-3 {{overloads for '>' exist with these partially matching parameter lists: (Int, Int)}}
790
791
if(cond || a)??(42>0){} // expected-error {{cannot be used as a boolean}} {{15-15=(}} {{16-16= != nil)}}
791
792
792
793
if cond || a ??42>0{} // Parses as the first one, not the others.
0 commit comments