diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index 11505ac0d943c..0c7074e6d4450 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -3194,12 +3194,11 @@ class DeclChecker : public DeclVisitor { void visitAssociatedTypeDecl(AssociatedTypeDecl *assocType) { if (assocType->isBeingTypeChecked()) { - if (!assocType->hasType()) { + if (!assocType->isInvalid()) { assocType->setInvalid(); assocType->overwriteType(ErrorType::get(TC.Context)); + TC.diagnose(assocType->getLoc(), diag::circular_type_alias, assocType->getName()); } - - TC.diagnose(assocType->getLoc(), diag::circular_type_alias, assocType->getName()); return; } diff --git a/validation-test/compiler_crashers/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift b/validation-test/compiler_crashers_fixed/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift similarity index 83% rename from validation-test/compiler_crashers/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift rename to validation-test/compiler_crashers_fixed/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift index f484c51efa649..c318dfff752cd 100644 --- a/validation-test/compiler_crashers/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift +++ b/validation-test/compiler_crashers_fixed/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift @@ -1,4 +1,4 @@ -// RUN: not --crash %target-swift-frontend %s -parse +// RUN: not %target-swift-frontend %s -parse // Distributed under the terms of the MIT license // Test case submitted to project by https://github.com/practicalswift (practicalswift)