From 01b829656644f7cc0a90bea34dd6af1b51a81659 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sat, 19 Mar 2016 16:46:21 +0100 Subject: [PATCH] [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef) Stack trace: ``` swift: /path/to/llvm/include/llvm/ADT/TinyPtrVector.h:182: EltTy llvm::TinyPtrVector::front() const [EltTy = swift::ArchetypeBuilder::PotentialArchetype *]: Assertion `!empty() && "vector empty"' failed. 10 swift 0x0000000000f78281 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef) + 1089 11 swift 0x0000000000e885f7 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 359 16 swift 0x0000000000e52296 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150 19 swift 0x0000000000eb203a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218 20 swift 0x0000000000edc00c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812 21 swift 0x0000000000e401aa swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet, swift::ExprTypeCheckListener*) + 746 23 swift 0x0000000000eb2186 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134 24 swift 0x0000000000e755bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet, unsigned int) + 1117 25 swift 0x0000000000cc6e2f swift::CompilerInstance::performSema() + 3087 27 swift 0x000000000078d17c frontend_main(llvm::ArrayRef, char const*, void*) + 2492 28 swift 0x0000000000787c45 main + 2837 Stack dump: 0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28277-swift-archetypebuilder-getgenericsignature-82990f.o 1. While type-checking expression at [validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift:10:1 - line:13:23] RangeText="{ 2. While type-checking 'A' at validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift:11:1 :0: error: unable to execute command: Aborted :0: error: compile command failed due to signal (use -v to see invocation) ``` --- ...swift-archetypebuilder-getgenericsignature.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift diff --git a/validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift b/validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift new file mode 100644 index 00000000000..fcc1e86fe49 --- /dev/null +++ b/validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift @@ -0,0 +1,13 @@ +// This source file is part of the Swift.org open source project +// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See http://swift.org/LICENSE.txt for license information +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors + +// RUN: not --crash %target-swift-frontend %s -parse +// REQUIRES: asserts +{ +protocol A{ +func