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
Diagnose inout uses of 'lets' in constructors in the type checker.
Stored `let` properties of a struct, class, or actor permit
'inout' modification within the constructor body after they have been
initialized. Tentatively remove this rule, only allowing such `let`
properties to be initialized (assigned to) and not treated as `inout`.
Fixes rdar://127258363.
// expected-note@-1{{change 'let' to 'var' to make it mutable}}
1399
1400
generic(&arg){(g:S<Double>)->Voidin} // expected-error {{cannot convert value of type '(S<Double>) -> Void' to expected argument type '(S<Int>) -> Void'}}
1401
+
// expected-error@-1{{cannot pass immutable value as inout argument: 'arg' is a 'let' constant}}
1400
1402
}
1401
1403
1402
1404
// rdar://problem/62428353 - bad error message for passing `T` where `inout T` was expected
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=}}
1557
1559
1558
1560
let _ ="" // This is a comment
1559
-
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1558:13-1559:10=}}
1561
+
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1560:13-1561:10=}}
1560
1562
1561
1563
let _ ="" // This is a comment
1562
1564
/*
1563
1565
* The blank line below is part of the test case, do not delete it
1564
1566
*/
1567
+
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1563:13-1567:10=}}
1565
1568
1566
-
??"" // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1561:13-1566:10=}}
1567
-
1568
-
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-1569:9=}}
1569
+
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-1570:9=}}
1569
1570
"").isEmpty {}
1570
1571
1571
1572
if("" // This is a comment
1572
-
??"").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1571:9-1572:12=}}
1573
+
??"").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1572:9-1573:12=}}
0 commit comments