Skip to content

Commit 487258d

Browse files
committed
SIL: Allow lowering ErrorType
1 parent 5370ac0 commit 487258d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/SIL/TypeLowering.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ namespace {
237237
llvm_unreachable("shouldn't get an inout type here");
238238
}
239239
RetTy visitErrorType(CanErrorType type) {
240-
llvm_unreachable("shouldn't get an error type here");
240+
return asImpl().handleTrivial(type);
241241
}
242242

243243
// Dependent types should be contextualized before visiting.
@@ -501,9 +501,6 @@ namespace {
501501
static RecursiveProperties classifyType(CanType type, SILModule &M,
502502
CanGenericSignature sig,
503503
ResilienceExpansion expansion) {
504-
assert(!type->hasError() &&
505-
"Error types should not appear in type-checked AST");
506-
507504
return TypeClassifier(M, sig, expansion).visit(type);
508505
}
509506

@@ -1559,9 +1556,6 @@ TypeConverter::getTypeLowering(AbstractionPattern origType,
15591556

15601557
CanType TypeConverter::computeLoweredRValueType(AbstractionPattern origType,
15611558
CanType substType) {
1562-
assert(!substType->hasError() &&
1563-
"Error types should not appear in type-checked AST");
1564-
15651559
// AST function types are turned into SIL function types:
15661560
// - the type is uncurried as desired
15671561
// - types are turned into their unbridged equivalents, depending
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
public struct S {
2+
var x: DoesNotExist // expected-error {{use of undeclared type 'DoesNotExist'}}
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: %target-swift-frontend -verify -emit-ir -primary-file %s %S/Inputs/require-layout-error-other.swift -module-name layout
2+
3+
public func identity(_ s: S) -> S { return s }

0 commit comments

Comments
 (0)