Skip to content

Commit 653e224

Browse files
committed
Sema: handle ~<<error type>> gracefully
1 parent 99dec9f commit 653e224

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class CheckRepressions {
113113
/// repressed or return the inverted type.
114114
Type add(Type ty, InverseTypeRepr &repr,
115115
llvm::PointerUnion<const TypeDecl *, const ExtensionDecl *> decl) {
116-
if (!ty)
116+
if (!ty || ty->hasError())
117117
return Type();
118118
assert(!ty->is<ExistentialMetatypeType>());
119119
auto kp = ty->getKnownProtocol();

test/Parse/inverses.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ protocol U {}
44

55
enum Maybe<Thing: ~Copyable> : ~Copyable {}
66

7+
struct Pluto: ~Planet {} // expected-error {{cannot find type 'Planet' in scope}}
8+
79
func more() {
810
let _: any ~Copyable = 19
911

0 commit comments

Comments
 (0)