Skip to content

Commit f736540

Browse files
[swiftc] Add test case for crash triggered in swift::ValueDecl::setType(swift::Type)
Stack trace: ``` swift: /path/to/swift/lib/AST/Decl.cpp:1655: void swift::ValueDecl::setType(swift::Type): Assertion `!hasType() && "changing type of declaration"' failed. 8 swift 0x000000000108473c swift::ValueDecl::setType(swift::Type) + 92 9 swift 0x0000000000e788cc swift::configureConstructorType(swift::ConstructorDecl*, swift::Type, swift::Type, bool) + 428 14 swift 0x0000000000e7bf36 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150 15 swift 0x0000000000e9d962 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994 16 swift 0x0000000000c37c0f swift::CompilerInstance::performSema() + 3295 18 swift 0x00000000007c5e46 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2838 19 swift 0x0000000000791ed8 main + 2840 Stack dump: 0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28292-swift-valuedecl-settype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28292-swift-valuedecl-settype-ee60c6.o 1. While type-checking 'a' at validation-test/compiler_crashers/28292-swift-valuedecl-settype.swift:10:1 <unknown>:0: error: unable to execute command: Aborted <unknown>:0: error: compile command failed due to signal (use -v to see invocation) ```
1 parent 26fcf1a commit f736540

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See http://swift.org/LICENSE.txt for license information
6+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// RUN: not --crash %target-swift-frontend %s -parse
9+
// REQUIRES: asserts
10+
class a{init(A)class A:a

0 commit comments

Comments
 (0)