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 edd118a commit 90a2b3dCopy full SHA for 90a2b3d
lib/Sema/PreCheckTarget.cpp
@@ -1680,6 +1680,11 @@ void PreCheckTarget::markAnyValidSingleValueStmts(Expr *E) {
1680
while (auto *IIO = dyn_cast<InjectIntoOptionalExpr>(E))
1681
E = IIO->getSubExpr();
1682
}
1683
+
1684
+ // Look through "unsafe" expressions.
1685
+ if (auto UE = dyn_cast<UnsafeExpr>(E))
1686
+ E = UE->getSubExpr();
1687
1688
return dyn_cast<AssignExpr>(E);
1689
};
1690
test/Unsafe/safe.swift
@@ -241,3 +241,11 @@ func testMyArray(ints: MyArray<Int>) {
241
unsafe print(buffer.unsafeCount)
242
243
244
245
+func testUnsafeLHS() {
246
+ @unsafe var value: Int = 0
247
+ unsafe value = switch unsafe value {
248
+ case 0: 1
249
+ default: 0
250
+ }
251
+}
0 commit comments