-
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 softwareregressionswift 4.2type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-7663 |
Radar | rdar://problem/40165062 |
Original Reporter | @hamishknight |
Type | Bug |
Status | Closed |
Resolution | Done |
Environment
Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
Target: x86_64-apple-darwin17.5.0
Swift version 4.2-dev (LLVM d9cd6a5c49, Clang ed8876508e, Swift c363dad)
Target: x86_64-apple-darwin17.5.0
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, 4.2Regression, CompilerCrash, TypeChecker |
Assignee | None |
Priority | Medium |
md5: 138ffc917af8618ac53f03cac6f54c20
Issue Description:
The following yielded the compiler error "Generic parameter 'T' could not be inferred" in Swift 4.1, however it yields a segmentation fault on master (c363dad):
struct Foo<T, U> {
var value: U
func foob() -> Foo<T, U> {
return Foo(value) // in 4.1: Generic parameter 'T' could not be inferred
}
}
extension Foo where T == U {
init(_ value: U) {
self.value = value
}
}
Here's the stack trace:
0 swift 0x00000001063d3698 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000001063d3d26 SignalHandler(int) + 422
2 libsystem_platform.dylib 0x00007fff58f00f5a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000001 _sigtramp + 2802839745
4 swift 0x0000000103c9e617 swift::GenericFunctionType::substGenericArgs(swift::SubstitutionMap const&) + 231
5 swift 0x0000000103c9e522 swift::GenericFunctionType::substGenericArgs(llvm::ArrayRef<swift::Substitution>) + 34
6 swift 0x000000010382cde6 swift::UncurriedCandidate::UncurriedCandidate(swift::ValueDecl*, unsigned int) + 230
7 swift 0x000000010383083f swift::CalleeCandidateInfo::collectCalleeCandidates(swift::Expr*, bool) + 6671
8 swift 0x00000001037e23d8 (anonymous namespace)::FailureDiagnosis::visitApplyExpr(swift::ApplyExpr*) + 2824
9 swift 0x00000001037c6636 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 86
10 swift 0x00000001037cbb78 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3912
11 swift 0x00000001038b35c8 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>) + 120
12 swift 0x00000001038b6c58 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 872
13 swift 0x000000010394795c swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 7612
14 swift 0x0000000103945ca9 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 265
15 swift 0x0000000103944db5 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 85
16 swift 0x0000000103944138 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 328
17 swift 0x0000000103944ca1 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 465
18 swift 0x0000000103969ab2 typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 354
19 swift 0x000000010396a9e8 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1848
20 swift 0x00000001035aeabc swift::CompilerInstance::parseAndTypeCheckMainFile(swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 444
21 swift 0x00000001035ad6d0 swift::CompilerInstance::parseAndCheckTypes(swift::CompilerInstance::ImplicitImports const&) + 640
22 swift 0x00000001035ad018 swift::CompilerInstance::performSema() + 472
23 swift 0x00000001029eecf0 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1904
24 swift 0x00000001029ed576 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3318
25 swift 0x00000001029a9e3d main + 2317
26 libdyld.dylib 0x00007fff58bf2015 start + 1
27 libdyld.dylib 0x000000000000000d start + 2806046713
and stack dump:
0. Program arguments: /Users/Hamish/Desktop/swift-dev/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file /Users/Hamish/Dropbox/App Projects/Stack Overflow/how about it eh/how about it eh/main.swift -target x86_64-apple-darwin17.5.0 -enable-objc-interop -color-diagnostics -module-name null -o /var/folders/2s/m9mqt6bx6bsbfzt64whnsf080000gp/T/main-8a9336.o
1. While type-checking 'foob()' at /Users/Hamish/Dropbox/App Projects/Stack Overflow/how about it eh/how about it eh/main.swift:13:3
2. While type-checking statement at [/Users/Hamish/Dropbox/App Projects/Stack Overflow/how about it eh/how about it eh/main.swift:13:28 - line:15:3] RangeText="{
return Foo(value)
}"
3. While type-checking statement at [/Users/Hamish/Dropbox/App Projects/Stack Overflow/how about it eh/how about it eh/main.swift:14:5 - line:14:21] RangeText="return Foo(value)"
4. While type-checking expression at [/Users/Hamish/Dropbox/App Projects/Stack Overflow/how about it eh/how about it eh/main.swift:14:12 - line:14:21] RangeText="Foo(value)"
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 softwareregressionswift 4.2type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis