Skip to content

Commit 1e211b4

Browse files
Merge pull request swiftlang#79868 from nate-chandler/cherrypick/release/6.1/rdar145035291
6.1: Check file type better in this verifier.
2 parents 95c460d + 7f98c04 commit 1e211b4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/SIL/IR/TypeLowering.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -3196,19 +3196,17 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
31963196

31973197
if (auto *nominal = substType.getAnyNominal()) {
31983198
auto *module = nominal->getModuleContext();
3199-
if (module) {
3200-
if (module->isBuiltFromInterface()) {
3199+
if (module && module->isBuiltFromInterface()) {
32013200
// Don't verify for types in modules built from interfaces; the feature
32023201
// may not have been enabled in them.
32033202
return;
3204-
}
3205-
auto *file = dyn_cast_or_null<FileUnit>(module->getModuleScopeContext());
3206-
if (file && file->getKind() == FileUnitKind::Source) {
3207-
auto sourceFile = nominal->getParentSourceFile();
3208-
if (sourceFile && sourceFile->Kind == SourceFileKind::SIL) {
3209-
// Don't verify for types in SIL files.
3210-
return;
3211-
}
3203+
}
3204+
auto *file = nominal->getParentSourceFile();
3205+
if (file && file->getKind() == FileUnitKind::Source) {
3206+
auto sourceFile = nominal->getParentSourceFile();
3207+
if (sourceFile && sourceFile->Kind == SourceFileKind::SIL) {
3208+
// Don't verify for types in SIL files.
3209+
return;
32123210
}
32133211
}
32143212
}

test/IRGen/enum_value_semantics_future.sil

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// UNSUPPORTED: CPU=armv7s && OS=ios
99

1010
import Builtin
11+
import Swift
1112

1213
enum NoPayload {
1314
case a

0 commit comments

Comments
 (0)