Skip to content

[SR-10906] Crash when constrain generic class with concrete type #53296

@krzyzanowskim

Description

@krzyzanowskim
Previous ID SR-10906
Radar rdar://problem/51587755
Original Reporter @krzyzanowskim
Type Bug
Status Resolved
Resolution Done
Environment

swift-DEVELOPMENT-SNAPSHOT-2019-06-02-a.xctoolchain
macOS

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @xedin
Priority Medium

md5: cf7b84aa9d130d0ca6ebaf6cc775aef5

Issue Description:

See https://gist.github.com/krzyzanowskim/62d621c85f8fbbbd5a98f4480bd4d224 for readable code

Stacktrace:

Assertion failed: (AffectedDecl), function RequirementFailure, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/Sema/CSDiagnostics.h, line 199.
    Stack dump:
    0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-06-02-a.xctoolchain/usr/bin/swift -frontend -c -primary-file Untitled 19.swift -target x86_64-apple-darwin18.6.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -warn-long-expression-type-checking=200 -module-name main -o /var/folders/hl/5lwrrzrx20d2h38qww1kr9x80000gn/T/Untitled 19-1b53af.o 
    1.  Apple Swift version 5.1-dev (LLVM e56fafcd29, Swift 938cb0f75e)
    2.  While type-checking 'init()' (at Untitled 19.swift:13:5)
    3.  While type-checking statement at [Untitled 19.swift:13:12 - line:15:5] RangeText="{
            view.delegate = self
        "
    4.  While type-checking expression at [Untitled 19.swift:14:9 - line:14:25] RangeText="view.delegate = "
    0  swift                    0x0000000111928225 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
    1  swift                    0x00000001119274e5 llvm::sys::RunSignalHandlers() + 85
    2  swift                    0x0000000111928808 SignalHandler(int) + 264
    3  libsystem_platform.dylib 0x00007fff7a5a0b5d _sigtramp + 29
    4  swift                    0x0000000112b8b7b0 cmark_strbuf__initbuf + 130059
    5  libsystem_c.dylib        0x00007fff7a45a6a6 abort + 127
    6  libsystem_c.dylib        0x00007fff7a42320d basename_r + 0
    7  swift                    0x000000010e80486f swift::constraints::RequirementFailure::RequirementFailure(swift::constraints::ConstraintSystem&, swift::Expr*, swift::RequirementKind, swift::constraints::ConstraintLocator*) + 463
    8  swift                    0x000000010e8016dd swift::constraints::SkipSameTypeRequirement::diagnose(swift::Expr*, bool) const + 61
    9  swift                    0x000000010e767e8b swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&)::$_12::operator()(swift::Expr*) const + 203
    10 swift                    0x000000010e767cc4 swift::constraints::ConstraintSystem::applySolutionFixes(swift::Expr*, swift::constraints::Solution const&) + 548
    11 swift                    0x000000010e767fb8 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 72
    12 swift                    0x000000010e8b236a swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 1066
    13 swift                    0x000000010e8b1f2f swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 63
    14 swift                    0x000000010e952476 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 614
    15 swift                    0x000000010e9513f8 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 136
    16 swift                    0x000000010e950332 swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 722
    17 swift                    0x000000010e950aae swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 334
    18 swift                    0x000000010e972db3 typeCheckFunctionsAndExternalDecls(swift::SourceFile&, swift::TypeChecker&) + 275
    19 swift                    0x000000010e97361b swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1019
    20 swift                    0x000000010e0b1b26 swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 502
    21 swift                    0x000000010e0b07f6 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 342
    22 swift                    0x000000010e0affe7 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 615
    23 swift                    0x000000010de79132 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1730
    24 swift                    0x000000010de77a01 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3025
    25 swift                    0x000000010de1d9b9 main + 729
    26 libdyld.dylib            0x00007fff7a3b53d5 start + 1
    27 libdyld.dylib            0x000000000000000f start + 2244258875
    <unknown>:0: error: unable to execute command: Abort trap: 6
    <unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions