mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`. Current number of unresolved compiler crashers: 97 (5282 resolved) Assertion failure in [`include/swift/AST/Type.h (line 288)`](https://github.com/apple/swift/blob/master/include/swift/AST/Type.h#L288): ``` Assertion `isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"' failed. When executing: swift::CanType::CanType(swift::TypeBase *) ``` Assertion context: ``` static ClassDecl *getClassBoundImpl(CanType type); public: explicit CanType(TypeBase *P = 0) : Type(P) { assert(isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"); } explicit CanType(Type T) : Type(T) { assert(isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"); } ``` Stack trace: ``` 0 0x00000000034c7488 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x34c7488) 1 0x00000000034c7bc6 SignalHandler(int) (/path/to/swift/bin/swift+0x34c7bc6) 2 0x00007f6bcbec73e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0) 3 0x00007f6bca5f5428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0 4 0x00007f6bca5f702a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0 5 0x000000000346333d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) (/path/to/swift/bin/swift+0x346333d) 6 0x0000000000e46fb9 (/path/to/swift/bin/swift+0xe46fb9) 7 0x0000000000d3bdf9 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0xd3bdf9) 8 0x0000000000d3c05a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0xd3c05a) 9 0x0000000000dcd3e5 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0xdcd3e5) 10 0x0000000000dcf425 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0xdcf425) 11 0x0000000000dcf000 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0xdcf000) 12 0x0000000000dcba7e swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0xdcba7e) 13 0x0000000000d3ad94 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0xd3ad94) 14 0x0000000000d3d6c7 (anonymous namespace)::FindCapturedVars::propagateCaptures(swift::AnyFunctionRef, swift::SourceLoc) (/path/to/swift/bin/swift+0xd3d6c7) 15 0x0000000000d3c44a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0xd3c44a) 16 0x0000000000dcc5e6 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0xdcc5e6) 17 0x0000000000dcec1e (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0xdcec1e) 18 0x0000000000dcef34 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0xdcef34) 19 0x0000000000dcba7e swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0xdcba7e) 20 0x0000000000d3ad94 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0xd3ad94) 21 0x0000000000c67f7b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0xc67f7b) 22 0x0000000000c68689 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0xc68689) 23 0x0000000000987046 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0x987046) 24 0x000000000047c446 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x47c446) 25 0x000000000043ace7 main (/path/to/swift/bin/swift+0x43ace7) 26 0x00007f6bca5e0830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0 27 0x0000000000438129 _start (/path/to/swift/bin/swift+0x438129) ```
14 lines
450 B
Swift
14 lines
450 B
Swift
// This source file is part of the Swift.org open source project
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
// RUN: not --crash %target-swift-frontend %s -emit-ir
|
|
// REQUIRES: asserts
|
|
{_{return 1 + 2
|
|
A{
|
|
}}
|
|
[_
|