Skip to content

Commit 468371f

Browse files
Merge pull request #79586 from nate-chandler/rdar145035291
Check file type better in this verifier.
2 parents bb65b08 + d1f89ea commit 468371f

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
@@ -3228,19 +3228,17 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
32283228

32293229
if (auto *nominal = substType.getAnyNominal()) {
32303230
auto *module = nominal->getModuleContext();
3231-
if (module) {
3232-
if (module->isBuiltFromInterface()) {
3231+
if (module && module->isBuiltFromInterface()) {
32333232
// Don't verify for types in modules built from interfaces; the feature
32343233
// may not have been enabled in them.
32353234
return;
3236-
}
3237-
auto *file = dyn_cast_or_null<FileUnit>(module->getModuleScopeContext());
3238-
if (file && file->getKind() == FileUnitKind::Source) {
3239-
auto sourceFile = nominal->getParentSourceFile();
3240-
if (sourceFile && sourceFile->Kind == SourceFileKind::SIL) {
3241-
// Don't verify for types in SIL files.
3242-
return;
3243-
}
3235+
}
3236+
auto *file = nominal->getParentSourceFile();
3237+
if (file && file->getKind() == FileUnitKind::Source) {
3238+
auto sourceFile = nominal->getParentSourceFile();
3239+
if (sourceFile && sourceFile->Kind == SourceFileKind::SIL) {
3240+
// Don't verify for types in SIL files.
3241+
return;
32443242
}
32453243
}
32463244
}

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)