Skip to content

Commit 1ac8adb

Browse files
authored
Merge pull request #60423 from DougGregor/downgrade-more-flow-isolation-warnings
2 parents 7fbcd8f + b88d9d7 commit 1ac8adb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/SILOptimizer/Mandatory/FlowIsolation.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,15 @@ void Info::diagnoseAll(AnalysisInfo &info, bool forDeinit,
422422
if (propertyUses.empty())
423423
return;
424424

425+
auto *fn = info.getFunction();
426+
auto &ctx = fn->getASTContext();
427+
428+
// Disable these diagnostics in deinitializers unless complete checking is
429+
// enabled.
430+
if (forDeinit && ctx.LangOpts.StrictConcurrencyLevel
431+
!= StrictConcurrency::Complete)
432+
return;
433+
425434
// Blame that is valid for the first property use is valid for all uses
426435
// in this block.
427436
if (!blame)
@@ -438,7 +447,6 @@ void Info::diagnoseAll(AnalysisInfo &info, bool forDeinit,
438447
}
439448
}
440449

441-
auto *fn = info.getFunction();
442450
auto &diag = fn->getASTContext().Diags;
443451

444452
SILLocation blameLoc = blame->getDebugLocation().getLocation();

test/Concurrency/flow_isolation_nonstrict.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-swift-frontend -strict-concurrency=targeted -swift-version 5 -parse-as-library -emit-sil -verify %s
22

3+
@_nonSendable
34
class NonSendableType {
45
var x: Int = 0
56
func f() {}
@@ -28,3 +29,14 @@ actor CheckDeinitFromActor {
2829
ns = nil
2930
}
3031
}
32+
33+
@MainActor class X {
34+
var ns: NonSendableType = NonSendableType()
35+
36+
nonisolated func something() { }
37+
38+
deinit {
39+
something()
40+
print(ns)
41+
}
42+
}

0 commit comments

Comments
 (0)