File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
validation-test/compiler_crashers_fixed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -2553,9 +2553,14 @@ namespace {
2553
2553
Diag<> diag_no_base_class) {
2554
2554
DeclContext *typeContext = selfDecl->getDeclContext ()->getParent ();
2555
2555
assert (typeContext && " constructor without parent context?!" );
2556
+
2557
+ // A DC can fail to have a declared type in context when it's invalid.
2558
+ Type declaredType = typeContext->getDeclaredTypeInContext ();
2559
+ if (!declaredType)
2560
+ return Type ();
2561
+
2556
2562
auto &tc = CS.getTypeChecker ();
2557
- ClassDecl *classDecl = typeContext->getDeclaredTypeInContext ()
2558
- ->getClassOrBoundGenericClass ();
2563
+ ClassDecl *classDecl = declaredType->getClassOrBoundGenericClass ();
2559
2564
if (!classDecl) {
2560
2565
tc.diagnose (diagLoc, diag_not_in_class);
2561
2566
return Type ();
@@ -2565,8 +2570,7 @@ namespace {
2565
2570
return Type ();
2566
2571
}
2567
2572
2568
- Type superclassTy = typeContext->getDeclaredTypeInContext ()
2569
- ->getSuperclass (&tc);
2573
+ Type superclassTy = declaredType->getSuperclass (&tc);
2570
2574
if (selfDecl->hasType () && selfDecl->getType ()->is <AnyMetatypeType>())
2571
2575
superclassTy = MetatypeType::get (superclassTy);
2572
2576
return superclassTy;
Original file line number Diff line number Diff line change 5
5
// See http://swift.org/LICENSE.txt for license information
6
6
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7
7
8
- // RUN: not --crash %target-swift-frontend %s -parse
8
+ // RUN: not %target-swift-frontend %s -parse
9
9
{ extension { let h{ B { } { var _= super. i
You can’t perform that action at this time.
0 commit comments