From e437a0e14ccbc47e50223469f828f9ea583f5936 Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Mon, 7 Dec 2015 02:26:43 -0800 Subject: [PATCH] Fix duplicate error and re-categorize test This crashing test became non-crashing in #138. #138 also emitted multiple instances of the same diagnostic, which was causing -verify to fail on decl/protocol/req/recursion.swift. --- lib/Sema/TypeCheckDecl.cpp | 5 ++--- ...nstraints-constraintsystem-simplifymemberconstraint.swift | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) rename validation-test/{compiler_crashers => compiler_crashers_fixed}/1741-swift-constraints-constraintsystem-simplifymemberconstraint.swift (83%) 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)