Skip to content

Commit 893a70e

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:1753: void swift::ValueDecl::setType(swift::Type): Assertion `!hasType() && "changing type of declaration"' failed. 8 swift 0x0000000000fd680c swift::ValueDecl::setType(swift::Type) + 92 9 swift 0x0000000000fdfbf5 swift::EnumElementDecl::computeType() + 277 13 swift 0x0000000000e39286 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150 16 swift 0x0000000000e7f79a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218 17 swift 0x0000000000ea987c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812 18 swift 0x0000000000e1e3ab swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 683 21 swift 0x0000000000e7e4ba swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 362 22 swift 0x0000000000e7e30e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46 23 swift 0x0000000000e7eed8 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136 25 swift 0x0000000000e05802 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1730 26 swift 0x0000000000cafccf swift::CompilerInstance::performSema() + 2975 28 swift 0x0000000000775367 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2487 29 swift 0x000000000076ff45 main + 2773 Stack dump: 0. Program arguments: /path/to/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28218-swift-valuedecl-settype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28218-swift-valuedecl-settype-de68ab.o 1. While type-checking getter for a at validation-test/compiler_crashers/28218-swift-valuedecl-settype.swift:8:6 2. While type-checking expression at [validation-test/compiler_crashers/28218-swift-valuedecl-settype.swift:8:7 - line:8:37] RangeText="{enum a{case c(c(class c]func c" 3. While type-checking 'a' at validation-test/compiler_crashers/28218-swift-valuedecl-settype.swift:8:8 <unknown>:0: error: unable to execute command: Aborted <unknown>:0: error: compile command failed due to signal (use -v to see invocation) ```
1 parent b3ac017 commit 893a70e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: not --crash %target-swift-frontend %s -parse
2+
// REQUIRES: asserts
3+
4+
// Distributed under the terms of the MIT license
5+
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
6+
// Test case found by fuzzing
7+
8+
let a{{enum a{case c(c(class c]func c

0 commit comments

Comments
 (0)