Skip to content

Commit 5ca61f6

Browse files
authored
Merge pull request #3331 from gregomni/getDeclaredType-cleanup
2 parents 2abc92b + 8d02354 commit 5ca61f6

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

lib/AST/Decl.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,10 +1994,8 @@ Type NominalTypeDecl::getDeclaredTypeInContext() const {
19941994
return DeclaredTyInContext;
19951995

19961996
auto *decl = const_cast<NominalTypeDecl *>(this);
1997-
auto Ty = computeNominalType(decl, DeclTypeKind::DeclaredTypeInContext);
1998-
if (!Ty)
1999-
Ty = ErrorType::get(getASTContext());
2000-
decl->DeclaredTyInContext = Ty;
1997+
decl->DeclaredTyInContext = computeNominalType(decl,
1998+
DeclTypeKind::DeclaredTypeInContext);
20011999
return DeclaredTyInContext;
20022000
}
20032001

lib/AST/DeclContext.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ enum class DeclTypeKind : unsigned {
127127
};
128128

129129
static Type computeExtensionType(const ExtensionDecl *ED, DeclTypeKind kind) {
130-
auto type = ED->getExtendedType();
130+
if (ED->isInvalid())
131+
return ErrorType::get(ED->getASTContext());
131132

133+
auto type = ED->getExtendedType();
132134
if (!type)
133135
return Type();
134136

validation-test/compiler_crashers/28324-swift-diagnosticengine-emitdiagnostic.swift renamed to validation-test/compiler_crashers_fixed/28324-swift-diagnosticengine-emitdiagnostic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
// See http://swift.org/LICENSE.txt for license information
66
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -parse
8+
// RUN: not %target-swift-frontend %s -parse
99
// REQUIRES: asserts
1010
protocol a{extension{@objc protocol A:a

validation-test/compiler_crashers/28326-swift-typebase-getmembersubstitutions.swift renamed to validation-test/compiler_crashers_fixed/28326-swift-typebase-getmembersubstitutions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
// See http://swift.org/LICENSE.txt for license information
66
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
77

8-
// RUN: not --crash %target-swift-frontend %s -parse
8+
// RUN: not %target-swift-frontend %s -parse
99
class d{init(){{extension{{}protocol a{struct B{let a

0 commit comments

Comments
 (0)