-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaretype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-5013 |
Radar | None |
Original Reporter | @hartbit |
Type | Bug |
Status | Resolved |
Resolution | Done |
Environment
24-05-2107 master snapshot
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, CompilerCrash, TypeChecker |
Assignee | @slavapestov |
Priority | Medium |
md5: eadb1113b7c82fbbd2d939bbcdda1c72
Issue Description:
The compiler crasher when trying to compile the following piece of code on the 24-05-2107 master toolchain:
protocol A {
associatedtype B
}
extension A {
func foo() {
(B.self as! Sequence.Type).Element
}
}
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm/include/llvm/Support/Casting.h, line 236.
0 swift 0x0000000109f12908 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x0000000109f118d6 llvm::sys::RunSignalHandlers() + 86
2 swift 0x0000000109f12ec9 SignalHandler(int) + 361
3 libsystem_platform.dylib 0x00007fffdf351b3a _sigtramp + 26
4 libsystem_platform.dylib 0x010000010b8a0e00 _sigtramp + 743764704
5 libsystem_c.dylib 0x00007fffdf1d6420 abort + 129
6 libsystem_c.dylib 0x00007fffdf19d893 basename_r + 0
7 swift 0x0000000107b1fc4b swift::constraints::ConstraintSystem::getTypeOfMemberReference(swift::Type, swift::ValueDecl*, swift::DeclContext*, bool, bool, swift::FunctionRefKind, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*, llvm::DenseMap<swift::GenericTypeParamType*, swift::TypeVariableType*, llvm::DenseMapInfo<swift::GenericTypeParamType*>, llvm::detail::DenseMapPair<swift::GenericTypeParamType*, swift::TypeVariableType*> >*) + 3227
8 swift 0x0000000107b20397 swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice, swift::DeclContext*) + 791
9 swift 0x0000000107b1fef9 swift::constraints::ConstraintSystem::addOverloadSet(swift::Type, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::DeclContext*, swift::constraints::ConstraintLocator*, swift::constraints::OverloadChoice*) + 233
10 swift 0x0000000107ae4df3 swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::ConstraintKind, swift::Type, swift::DeclName, swift::Type, swift::DeclContext*, swift::FunctionRefKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 515
11 swift 0x0000000107ad0543 swift::constraints::ConstraintSystem::addValueMemberConstraint(swift::Type, swift::DeclName, swift::Type, swift::DeclContext*, swift::FunctionRefKind, swift::constraints::ConstraintLocatorBuilder) + 179
12 swift 0x0000000107ad0b9d (anonymous namespace)::ConstraintGenerator::addMemberRefConstraints(swift::Expr*, swift::Expr*, swift::DeclName, swift::FunctionRefKind) + 237
13 swift 0x0000000107ac6610 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) + 11584
14 swift 0x0000000107acbbfa (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 58
15 swift 0x0000000107c9ace6 swift::Expr::walk(swift::ASTWalker&) + 118
16 swift 0x0000000107ac28c8 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 264
17 swift 0x0000000107af1a1f swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 415
18 swift 0x0000000107b706e4 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 340
19 swift 0x0000000107b7375f swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 655
20 swift 0x0000000107bf1098 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 520
21 swift 0x0000000107bf0389 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 25
22 swift 0x0000000107bef709 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 345
23 swift 0x0000000107bef54f swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 111
24 swift 0x0000000107bf00db swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 251
25 swift 0x0000000107c0c87a typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 202
26 swift 0x0000000107c0d7ee swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1806
27 swift 0x000000010775eaf9 swift::CompilerInstance::performSema() + 3881
28 swift 0x0000000106d06c5b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 2427
29 swift 0x0000000106d0520a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2650
30 swift 0x0000000106cc1860 main + 3312
31 libdyld.dylib 0x00007fffdf142235 start + 1
32 libdyld.dylib 0x000000000000003e start + 552328714
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-05-21-a.xctoolchain/usr/bin/swift -frontend -c /Users/david/Desktop/Crasher/Crasher/ViewController.swift /Users/david/Desktop/Crasher/Crasher/AppDelegate.swift -primary-file /Users/david/Desktop/Crasher/Crasher/Crasher.swift -target x86_64-apple-ios10.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Products/Debug-iphonesimulator -F /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/david/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Crasher-generated-files.hmap -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Crasher-own-target-headers.hmap -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Crasher-all-target-headers.hmap -Xcc -iquote -Xcc /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Crasher-project-headers.hmap -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/DerivedSources/x86_64 -Xcc -I/Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/david/Desktop/Crasher -emit-module-doc-path /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Objects-normal/x86_64/Crasher~partial.swiftdoc -serialize-diagnostics-path /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Objects-normal/x86_64/Crasher.dia -Onone -module-name Crasher -emit-module-path /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Objects-normal/x86_64/Crasher~partial.swiftmodule -emit-dependencies-path /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Objects-normal/x86_64/Crasher.d -emit-reference-dependencies-path /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Objects-normal/x86_64/Crasher.swiftdeps -o /Users/david/Library/Developer/Xcode/DerivedData/Crasher-dwlabxbfwpmpbqgzvhgmayanfazd/Build/Intermediates/Crasher.build/Debug-iphonesimulator/Crasher.build/Objects-normal/x86_64/Crasher.o
1. While type-checking 'foo' at /Users/david/Desktop/Crasher/Crasher/Crasher.swift:16:5
2. While type-checking expression at [/Users/david/Desktop/Crasher/Crasher/Crasher.swift:17:9 - line:17:36] RangeText="(B.self as! Sequence.Type).E"
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaretype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis