Commit Graph

3633 Commits

Author SHA1 Message Date
Doug Gregor
29353013c0 Merge pull request #7124 from DougGregor/string-interpolation-generic
Replace concrete init(stringInterpolationSegment:)'s with generic ones
2017-01-28 01:17:37 -08:00
practicalswift
3600bf4f31 [swiftc (52 vs. 5433)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 52 (5433 resolved)

Stack trace:

```
0 0x00000000038a0e38 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x38a0e38)
1 0x00000000038a1576 SignalHandler(int) (/path/to/swift/bin/swift+0x38a1576)
2 0x00007f39775f93e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00000000014260d1 swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x14260d1)
4 0x000000000127dfe0 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x127dfe0)
5 0x000000000127e44a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127e44a)
6 0x00000000013a953e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a953e)
7 0x00000000013a833b swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a833b)
8 0x000000000127f460 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127f460)
9 0x00000000013a87fe (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a87fe)
10 0x00000000013ab9a8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13ab9a8)
11 0x00000000013a83be swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a83be)
12 0x000000000127d1e1 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x127d1e1)
13 0x00000000011b346b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b346b)
14 0x00000000011b3c45 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b3c45)
15 0x0000000000f08a26 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf08a26)
16 0x00000000004a46b6 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a46b6)
17 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
18 0x00007f3975f4a830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
19 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-28 08:36:00 +01:00
Doug Gregor
f6cac54606 Replace concrete init(stringInterpolationSegment:)'s with generic ones
Remove 16 concrete init(stringInterpolationSegment:) overloads and
replace them with 3 generic overloads, significantly reducing the
exponential blow-up from larger string interpolations.

Fixes rdar://problem/29389887.
2017-01-27 21:54:59 -08:00
Max Moiseev
06a45cb8fd Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-27 16:36:41 -08:00
Jordan Rose
7c8117301a In Swift 3 mode, allow "tuple unsplatting" in certain cases. (#7077)
Swift 3.0 allowed constructing an enum or calling a function-typed
property with multiple arguments even when a single argument of tuple
type was expected. Emulate that in Swift 3 mode by wrapping in an
extra level of parentheses when the situation comes up.

Last vestiges of fallout from SE-0110. Hopefully last, anyway. A nice
follow-up to this commit might be to /warn/ in Swift 3 mode when this
happens.

rdar://problem/30171399
2017-01-27 11:19:07 -08:00
practicalswift
6169f7a808 [swiftc (51 vs. 5433)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 51 (5433 resolved)

/cc @lattner - just wanted to let you know that this crasher caused an assertion failure for the assertion `Result && "Case not implemented!"` added on 2011-03-22 by you in commit fd2bf74f :-)

Assertion failure in [`lib/AST/Type.cpp (line 1299)`](5fe6f33ae5/lib/AST/Type.cpp (L1299)):

```
Assertion `Result && "Case not implemented!"' failed.

When executing: swift::CanType swift::TypeBase::getCanonicalType()
```

Assertion context:

```c++
  }
  }

  // Cache the canonical type for future queries.
  assert(Result && "Case not implemented!");
  CanonicalType = Result;
  return CanType(Result);
}

```
Stack trace:

```
0 0x00000000038a11c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x38a11c8)
1 0x00000000038a1906 SignalHandler(int) (/path/to/swift/bin/swift+0x38a1906)
2 0x00007ff8833b73e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007ff881d1d428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007ff881d1f02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007ff881d15bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007ff881d15c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000001426e48 swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x1426e48)
8 0x000000000127e1e0 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x127e1e0)
9 0x000000000127e64a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127e64a)
10 0x00000000013a99fe swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a99fe)
11 0x00000000013a87fb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a87fb)
12 0x000000000127f660 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127f660)
13 0x00000000013a8cbe (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a8cbe)
14 0x00000000013ae264 (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) (/path/to/swift/bin/swift+0x13ae264)
15 0x00000000013a8d0b (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a8d0b)
16 0x00000000013abe68 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13abe68)
17 0x00000000013a887e swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a887e)
18 0x000000000127d3e1 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x127d3e1)
19 0x00000000011b3a0b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b3a0b)
20 0x00000000011b41e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b41e5)
21 0x0000000000f0ba26 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0ba26)
22 0x00000000004a4706 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4706)
23 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
24 0x00007ff881d08830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
25 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-27 12:08:23 +01:00
practicalswift
caf10480d5 [swiftc (50 vs. 5433)] Add crasher in swift::TypeChecker::validateDecl(...)
Add test case for crash triggered in `swift::TypeChecker::validateDecl(...)`.

Current number of unresolved compiler crashers: 50 (5433 resolved)

Assertion failure in `llvm/include/llvm/ADT/ArrayRef.h (line 411)`:

```
Assertion `Index < this->size() && "Invalid index!"' failed.

When executing: T &llvm::MutableArrayRef<swift::ParameterList *>::operator[](size_t) const [T = swift::ParameterList *]
```

Assertion context:

```c++

    /// @}
    /// @name Operator Overloads
    /// @{
    T &operator[](size_t Index) const {
      assert(Index < this->size() && "Invalid index!");
      return data()[Index];
    }
  };

  /// This is a MutableArrayRef that owns its array.
```
Stack trace:

```
0 0x00000000038a11c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x38a11c8)
1 0x00000000038a1906 SignalHandler(int) (/path/to/swift/bin/swift+0x38a1906)
2 0x00007f20e97a83e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f20e810e428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f20e811002a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f20e8106bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f20e8106c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x000000000129f6ee validateAttributes(swift::TypeChecker&, swift::Decl*) (/path/to/swift/bin/swift+0x129f6ee)
8 0x00000000012ad33a (anonymous namespace)::DeclChecker::visitDestructorDecl(swift::DestructorDecl*) (/path/to/swift/bin/swift+0x12ad33a)
9 0x000000000129d4c4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x129d4c4)
10 0x000000000129804d swift::TypeChecker::validateDecl(swift::ValueDecl*) (/path/to/swift/bin/swift+0x129804d)
11 0x00000000013f3485 isDeclVisibleInLookupMode(swift::ValueDecl*, (anonymous namespace)::LookupState, swift::DeclContext const*, swift::LazyResolver*) (/path/to/swift/bin/swift+0x13f3485)
12 0x00000000013f2d36 lookupTypeMembers(swift::Type, swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*) (/path/to/swift/bin/swift+0x13f2d36)
13 0x00000000013f0c7c lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*, llvm::SmallPtrSet<swift::TypeDecl*, 8u>&) (/path/to/swift/bin/swift+0x13f0c7c)
14 0x00000000013f06bf lookupVisibleMemberDecls(swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*) (/path/to/swift/bin/swift+0x13f06bf)
15 0x00000000013f0088 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) (/path/to/swift/bin/swift+0x13f0088)
16 0x00000000012c8be8 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) (/path/to/swift/bin/swift+0x12c8be8)
17 0x0000000001283f83 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) (/path/to/swift/bin/swift+0x1283f83)
18 0x000000000128fa72 (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x128fa72)
19 0x00000000013a87cb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a87cb)
20 0x00000000012847a5 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>) (/path/to/swift/bin/swift+0x12847a5)
21 0x0000000001287ed6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1287ed6)
22 0x000000000128bbf1 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, bool) (/path/to/swift/bin/swift+0x128bbf1)
23 0x000000000128bdbd swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int, bool) (/path/to/swift/bin/swift+0x128bdbd)
24 0x00000000012a1437 validatePatternBindingDecl(swift::TypeChecker&, swift::PatternBindingDecl*, unsigned int) (/path/to/swift/bin/swift+0x12a1437)
25 0x000000000129d54d (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x129d54d)
26 0x00000000012aac9b (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) (/path/to/swift/bin/swift+0x12aac9b)
27 0x000000000129d4a4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x129d4a4)
28 0x000000000129d3d3 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) (/path/to/swift/bin/swift+0x129d3d3)
29 0x00000000011b40e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b40e5)
30 0x0000000000f0ba26 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0ba26)
31 0x00000000004a4706 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4706)
32 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
33 0x00007f20e80f9830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
34 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-27 11:17:21 +01:00
swift-ci
79c5429c3b Merge pull request #7087 from practicalswift/swiftc-28670-reftype-hastypeparameter-cannot-have-a-dependent-type-here 2017-01-27 02:15:32 -08:00
Slava Pestov
1860fecace Merge pull request #7081 from slavapestov/protocol-typealiases-are-fun
AST: Fix compareDependentTypes() for protocol typealiases
2017-01-27 01:33:49 -08:00
practicalswift
49aaf06d0f [swiftc (49 vs. 5433)] Add crasher in swift::constraints::ConstraintSystem::resolveOverload
Add test case for crash triggered in `swift::constraints::ConstraintSystem::resolveOverload`.

Current number of unresolved compiler crashers: 49 (5433 resolved)

/cc @DougGregor - just wanted to let you know that this crasher caused an assertion failure for the assertion `!refType->hasTypeParameter() && "Cannot have a dependent type here"` added on 2015-07-07 by you in commit 3023a710 :-)

Assertion failure in [`lib/Sema/ConstraintSystem.cpp (line 1473)`](0fbb42ab51/lib/Sema/ConstraintSystem.cpp (L1473)):

```
Assertion `!refType->hasTypeParameter() && "Cannot have a dependent type here"' failed.

When executing: void swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator *, swift::Type, swift::constraints::OverloadChoice, swift::DeclContext *)
```

Assertion context:

```c++
      auto tuple = choice.getBaseType()->castTo<TupleType>();
      refType = tuple->getElementType(choice.getTupleIndex())->getRValueType();
    }
    break;
  }
  assert(!refType->hasTypeParameter() && "Cannot have a dependent type here");

  // If we're binding to an init member, the 'throws' need to line up between
  // the bound and reference types.
  if (choice.isDecl()) {
    auto decl = choice.getDecl();
```
Stack trace:

```
0 0x00000000038a11c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x38a11c8)
1 0x00000000038a1906 SignalHandler(int) (/path/to/swift/bin/swift+0x38a1906)
2 0x00007f355b08e3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f35599f4428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f35599f602a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f35599ecbd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f35599ecc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000012570b8 swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice, swift::DeclContext*) (/path/to/swift/bin/swift+0x12570b8)
8 0x00000000012fb7b8 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x12fb7b8)
9 0x00000000012fffd8 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x12fffd8)
10 0x00000000013aba9c (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0x13aba9c)
11 0x00000000013a87fb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a87fb)
12 0x00000000012f7bb3 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) (/path/to/swift/bin/swift+0x12f7bb3)
13 0x000000000122995d swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) (/path/to/swift/bin/swift+0x122995d)
14 0x0000000001284864 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>) (/path/to/swift/bin/swift+0x1284864)
15 0x0000000001287ed6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1287ed6)
16 0x000000000119eaae swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119eaae)
17 0x000000000119e11b swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) (/path/to/swift/bin/swift+0x119e11b)
18 0x00000000011b9f2c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) (/path/to/swift/bin/swift+0x11b9f2c)
19 0x0000000001287f60 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1287f60)
20 0x000000000119eaae swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119eaae)
21 0x000000000119cdcd swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x119cdcd)
22 0x000000000119cc38 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x119cc38)
23 0x000000000119d951 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/path/to/swift/bin/swift+0x119d951)
24 0x00000000011b3488 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b3488)
25 0x00000000011b41e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b41e5)
26 0x0000000000f0ba26 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0ba26)
27 0x00000000004a4706 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4706)
28 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
29 0x00007f35599df830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
30 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-27 10:24:55 +01:00
practicalswift
0a828e363b [swiftc (48 vs. 5433)] Add crasher in swift::TypeBase::getContextSubstitutions
Add test case for crash triggered in `swift::TypeBase::getContextSubstitutions`.

Current number of unresolved compiler crashers: 48 (5433 resolved)

/cc @slavapestov - just wanted to let you know that this crasher caused an assertion failure for the assertion `!baseTy->isLValueType() && !baseTy->is<AnyMetatypeType>()` added on 2017-01-02 by you in commit 18adb532 :-)

Assertion failure in [`lib/AST/Type.cpp (line 3138)`](6f19169df2/lib/AST/Type.cpp (L3138)):

```
Assertion `!baseTy->isLValueType() && !baseTy->is<AnyMetatypeType>()' failed.

When executing: TypeSubstitutionMap swift::TypeBase::getContextSubstitutions(const swift::DeclContext *)
```

Assertion context:

```c++

TypeSubstitutionMap TypeBase::getContextSubstitutions(const DeclContext *dc) {
  assert(dc->isTypeContext());
  Type baseTy(this);

  assert(!baseTy->isLValueType() && !baseTy->is<AnyMetatypeType>());

  // The resulting set of substitutions. Always use this to ensure we
  // don't miss out on NRVO anywhere.
  TypeSubstitutionMap substitutions;

```
Stack trace:

```
0 0x00000000038a11c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x38a11c8)
1 0x00000000038a1906 SignalHandler(int) (/path/to/swift/bin/swift+0x38a1906)
2 0x00007f51cc13e3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f51caaa4428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f51caaa602a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f51caa9cbd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f51caa9cc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x000000000142ff6a swift::TypeBase::getContextSubstitutions(swift::DeclContext const*) (/path/to/swift/bin/swift+0x142ff6a)
8 0x0000000001430091 swift::TypeBase::getMemberSubstitutions(swift::ValueDecl const*) (/path/to/swift/bin/swift+0x1430091)
9 0x00000000013f15fa (anonymous namespace)::OverrideFilteringConsumer::foundDecl(swift::ValueDecl*, swift::DeclVisibilityKind) (/path/to/swift/bin/swift+0x13f15fa)
10 0x00000000013f2db0 lookupTypeMembers(swift::Type, swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*) (/path/to/swift/bin/swift+0x13f2db0)
11 0x00000000013f0c7c lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*, llvm::SmallPtrSet<swift::TypeDecl*, 8u>&) (/path/to/swift/bin/swift+0x13f0c7c)
12 0x00000000013f06bf lookupVisibleMemberDecls(swift::Type, swift::VisibleDeclConsumer&, swift::DeclContext const*, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver*) (/path/to/swift/bin/swift+0x13f06bf)
13 0x00000000012c8bd1 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) (/path/to/swift/bin/swift+0x12c8bd1)
14 0x00000000011edbbf (anonymous namespace)::FailureDiagnosis::diagnoseUnviableLookupResults(swift::constraints::MemberLookupResult&, swift::Type, swift::Expr*, swift::DeclName, swift::DeclNameLoc, swift::SourceLoc) (/path/to/swift/bin/swift+0x11edbbf)
15 0x00000000011e0959 (anonymous namespace)::FailureDiagnosis::diagnoseConstraintFailure() (/path/to/swift/bin/swift+0x11e0959)
16 0x00000000011dc336 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11dc336)
17 0x00000000011e303d swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11e303d)
18 0x00000000012848a8 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>) (/path/to/swift/bin/swift+0x12848a8)
19 0x0000000001287ed6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1287ed6)
20 0x000000000119eaae swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119eaae)
21 0x000000000119cdcd swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x119cdcd)
22 0x000000000119cc38 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x119cc38)
23 0x000000000119d951 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/path/to/swift/bin/swift+0x119d951)
24 0x00000000011b3488 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b3488)
25 0x00000000011b41e5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b41e5)
26 0x0000000000f0ba26 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0ba26)
27 0x00000000004a4706 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4706)
28 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
29 0x00007f51caa8f830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
30 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-27 09:35:01 +01:00
practicalswift
dfac7d8bca [swiftc (47 vs. 5433)] Add crasher in swift::InFlightDiagnostic
Add test case for crash triggered in `swift::InFlightDiagnostic`.

Current number of unresolved compiler crashers: 47 (5433 resolved)

Assertion failure in [`include/swift/AST/DiagnosticEngine.h (line 611)`](fe81da34e4/include/swift/AST/DiagnosticEngine.h (L611)):

```
Assertion `!ActiveDiagnostic && "Already have an active diagnostic"' failed.

When executing: swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose(swift::SourceLoc, const swift::Diagnostic &)
```

Assertion context:

```c++
    /// \param D The diagnostic.
    ///
    /// \returns An in-flight diagnostic, to which additional information can
    /// be attached.
    InFlightDiagnostic diagnose(SourceLoc Loc, const Diagnostic &D) {
      assert(!ActiveDiagnostic && "Already have an active diagnostic");
      ActiveDiagnostic = D;
      ActiveDiagnostic->setLoc(Loc);
      return InFlightDiagnostic(*this);
    }

```
Stack trace:

```
0 0x00000000038a11c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x38a11c8)
1 0x00000000038a1906 SignalHandler(int) (/path/to/swift/bin/swift+0x38a1906)
2 0x00007f86c83253e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f86c6c8b428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f86c6c8d02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f86c6c83bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f86c6c83c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000011079f8 swift::InFlightDiagnostic swift::Lexer::diagnose<>(char const*, swift::Diag<>) (/path/to/swift/bin/swift+0x11079f8)
8 0x0000000001106960 swift::Lexer::lexImpl() (/path/to/swift/bin/swift+0x1106960)
9 0x000000000114612b swift::Parser::consumeToken() (/path/to/swift/bin/swift+0x114612b)
10 0x00000000011467eb swift::Parser::skipSingle() (/path/to/swift/bin/swift+0x11467eb)
11 0x00000000011467f8 swift::Parser::skipSingle() (/path/to/swift/bin/swift+0x11467f8)
12 0x00000000011419ea swift::Parser::parseSingleParameterClause(swift::Parser::ParameterContextKind, llvm::SmallVectorImpl<swift::Identifier>*, swift::Parser::DefaultArgumentInfo*) (/path/to/swift/bin/swift+0x11419ea)
13 0x00000000011218de swift::Parser::parseDeclInit(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) (/path/to/swift/bin/swift+0x11218de)
14 0x0000000001119961 swift::Parser::parseDecl(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, llvm::function_ref<void (swift::Decl*)>) (/path/to/swift/bin/swift+0x1119961)
15 0x000000000117911c swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) (/path/to/swift/bin/swift+0x117911c)
16 0x000000000110e756 swift::Parser::parseTopLevel() (/path/to/swift/bin/swift+0x110e756)
17 0x000000000114500d swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) (/path/to/swift/bin/swift+0x114500d)
18 0x0000000000f0ba03 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0ba03)
19 0x00000000004a4706 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4706)
20 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
21 0x00007f86c6c76830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
22 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-27 07:56:01 +01:00
practicalswift
fe81da34e4 Merge pull request #7027 from practicalswift/swiftc-28667-result-case-not-implemented
[swiftc (46 vs. 5433)] Add crasher in swift::TypeBase::getCanonicalType(...)
2017-01-27 07:55:41 +01:00
Slava Pestov
f9789ce5a8 AST: Fix compareDependentTypes() for protocol typealiases
We must order protocol typealiases *after* other types, so that
if a protocol typealias is equal to an associated type, the
representative is chosen to be the associated type and not the
typealias.

Fixes <https://bugs.swift.org/browse/SR-3687> and
<rdar://problem/30118513>.
2017-01-26 21:33:25 -08:00
Max Moiseev
90ef26824f Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-26 15:28:42 -08:00
practicalswift
0d30bf213f Add "// REQUIRES: deterministic-behavior" 2017-01-26 16:17:25 +01:00
Jordan Rose
25e40d0a57 Use interface types when checking #keyPath. (#7028)
This avoids a crash when the path refers to a property in another
Swift module.

https://bugs.swift.org/browse/SR-3714
2017-01-25 19:29:42 -08:00
Mishal Shah
92ef777085 Update master to build with Xcode 8.3 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2017-01-25 16:13:36 -08:00
practicalswift
36711f8411 [swiftc (46 vs. 5433)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 46 (5433 resolved)

/cc @lattner - just wanted to let you know that this crasher caused an assertion failure for the assertion `Result && "Case not implemented!"` added on 2011-03-22 by you in commit fd2bf74f :-)

Assertion failure in [`lib/AST/Type.cpp (line 1299)`](6267f47959/lib/AST/Type.cpp (L1299)):

```
Assertion `Result && "Case not implemented!"' failed.

When executing: swift::CanType swift::TypeBase::getCanonicalType()
```

Assertion context:

```c++
  }
  }

  // Cache the canonical type for future queries.
  assert(Result && "Case not implemented!");
  CanonicalType = Result;
  return CanType(Result);
}

```
Stack trace:

```
0 0x000000000389db88 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x389db88)
1 0x000000000389e2c6 SignalHandler(int) (/path/to/swift/bin/swift+0x389e2c6)
2 0x00007fd91157e3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fd90fee4428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fd90fee602a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007fd90fedcbd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007fd90fedcc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000001422e68 swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x1422e68)
8 0x000000000127c0c0 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x127c0c0)
9 0x000000000127c52a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127c52a)
10 0x00000000013a718e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a718e)
11 0x00000000013a5f8b swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a5f8b)
12 0x000000000127d540 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127d540)
13 0x00000000013a644e (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a644e)
14 0x00000000013a65e7 (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a65e7)
15 0x00000000013a95f8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13a95f8)
16 0x00000000013a600e swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a600e)
17 0x000000000127b2c1 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x127b2c1)
18 0x00000000011b16bb typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b16bb)
19 0x00000000011b1e95 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b1e95)
20 0x0000000000f0bae6 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0bae6)
21 0x00000000004a4706 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4706)
22 0x00000000004639c7 main (/path/to/swift/bin/swift+0x4639c7)
23 0x00007fd90fecf830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
24 0x0000000000461069 _start (/path/to/swift/bin/swift+0x461069)
```
2017-01-25 14:15:16 +01:00
practicalswift
6267f47959 Merge pull request #7013 from practicalswift/swiftc-28666-conformingreplacementtype-is-substitutabletype-conformingreplacementtype-is-depe
[swiftc (45 vs. 5433)] Add crasher in swift::Type::transformRec
2017-01-25 14:14:54 +01:00
practicalswift
9a8cba1579 Add "// REQUIRES: OS=linux-gnu" 2017-01-25 08:37:04 +01:00
Doug Gregor
aed206fbaa Mark test as requiring deterministic behavior.
Fails occasionally with “a type variable escaped the type checker”.
2017-01-24 19:36:56 -08:00
Slava Pestov
8ad5504fe0 SILGen: Relax assertion in tuple-to-optional function result conversion
Now that optional payloads can be re-abstracted, there's a case
where we need to do a tuple-to-tuple conversion on a direct result;
if the result is wrapped in an Optional. So I believe this assert
is not right.

Fixes <https://bugs.swift.org/browse/SR-3706>.
2017-01-24 18:47:21 -08:00
practicalswift
cadc733c09 [swiftc (45 vs. 5433)] Add crasher in swift::Type::transformRec
Add test case for crash triggered in `swift::Type::transformRec`.

Current number of unresolved compiler crashers: 45 (5433 resolved)

/cc @jckarter - just wanted to let you know that this crasher caused an assertion failure for the assertion `(conformingReplacementType->is<SubstitutableType>() || conformingReplacementType->is<DependentMemberType>()) && "replacement requires looking up a concrete conformance"` added on 2016-12-15 by you in commit 57d9ad0a :-)

Assertion failure in [`lib/AST/Type.cpp (line 2971)`](5e45c3920f/lib/AST/Type.cpp (L2971)):

```
Assertion `(conformingReplacementType->is<SubstitutableType>() || conformingReplacementType->is<DependentMemberType>()) && "replacement requires looking up a concrete conformance"' failed.

When executing: Optional<swift::ProtocolConformanceRef> swift::MakeAbstractConformanceForGenericType::operator()(swift::CanType, swift::Type, swift::ProtocolType *) const
```

Assertion context:

```c++
MakeAbstractConformanceForGenericType::operator()(CanType dependentType,
                                       Type conformingReplacementType,
                                       ProtocolType *conformedProtocol) const {
  assert((conformingReplacementType->is<SubstitutableType>()
          || conformingReplacementType->is<DependentMemberType>())
         && "replacement requires looking up a concrete conformance");
  return ProtocolConformanceRef(conformedProtocol->getDecl());
}

Type DependentMemberType::substBaseType(ModuleDecl *module,
                                        Type substBase,
```
Stack trace:

```
0 0x000000000389c558 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x389c558)
1 0x000000000389cc96 SignalHandler(int) (/path/to/swift/bin/swift+0x389cc96)
2 0x00007f2753da73e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f275270d428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f275270f02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f2752705bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f2752705c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x000000000142a619 (/path/to/swift/bin/swift+0x142a619)
8 0x0000000000592d09 llvm::Optional<swift::ProtocolConformanceRef> llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>::callback_fn<swift::MakeAbstractConformanceForGenericType>(long, swift::CanType, swift::Type, swift::ProtocolType*) (/path/to/swift/bin/swift+0x592d09)
9 0x000000000142a9f9 getMemberForBaseType(llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>, swift::Type, swift::Type, swift::AssociatedTypeDecl*, swift::Identifier, swift::OptionSet<swift::SubstFlags, unsigned int>) (/path/to/swift/bin/swift+0x142a9f9)
10 0x000000000142ecf0 llvm::Optional<swift::Type> llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>::callback_fn<substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>, swift::OptionSet<swift::SubstFlags, unsigned int>)::$_14>(long, swift::TypeBase*) (/path/to/swift/bin/swift+0x142ecf0)
11 0x000000000142b929 swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const (/path/to/swift/bin/swift+0x142b929)
12 0x000000000142c4f4 swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const (/path/to/swift/bin/swift+0x142c4f4)
13 0x000000000142be97 swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const (/path/to/swift/bin/swift+0x142be97)
14 0x000000000142b8c3 swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const (/path/to/swift/bin/swift+0x142b8c3)
15 0x000000000142be97 swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const (/path/to/swift/bin/swift+0x142be97)
16 0x000000000142beca swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const (/path/to/swift/bin/swift+0x142beca)
17 0x000000000142adde swift::Type::substDependentTypesWithErrorTypes() const (/path/to/swift/bin/swift+0x142adde)
18 0x00000000013e72e9 swift::GenericEnvironment::mapTypeIntoContext(swift::ModuleDecl*, swift::GenericEnvironment*, swift::Type) (/path/to/swift/bin/swift+0x13e72e9)
19 0x000000000119ce64 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119ce64)
20 0x000000000119baad swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119baad)
21 0x0000000001199e9d swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x1199e9d)
22 0x0000000001199d08 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x1199d08)
23 0x000000000119aa21 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/path/to/swift/bin/swift+0x119aa21)
24 0x00000000011b0558 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b0558)
25 0x00000000011b12b5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b12b5)
26 0x0000000000f0b896 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b896)
27 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
28 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
29 0x00007f27526f8830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
30 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-25 01:16:40 +01:00
practicalswift
25b9d0ef34 [swiftc (44 vs. 5433)] Add crasher in swift::ASTVisitor
Add test case for crash triggered in `swift::ASTVisitor`.

Current number of unresolved compiler crashers: 44 (5433 resolved)

Stack trace:

```
0 0x000000000389c558 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x389c558)
1 0x000000000389cc96 SignalHandler(int) (/path/to/swift/bin/swift+0x389cc96)
2 0x00007fb4bb36e3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fb4b9cd4428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fb4b9cd602a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x0000000003838aad llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) (/path/to/swift/bin/swift+0x3838aad)
6 0x000000000142630d (/path/to/swift/bin/swift+0x142630d)
7 0x000000000127b6e9 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x127b6e9)
8 0x000000000127b94a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127b94a)
9 0x00000000013a64ce swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a64ce)
10 0x00000000013a52cb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a52cb)
11 0x000000000127c960 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127c960)
12 0x00000000013a578e (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a578e)
13 0x00000000013a8938 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13a8938)
14 0x00000000013a534e swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a534e)
15 0x000000000127a6e1 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x127a6e1)
16 0x00000000011b0adb typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11b0adb)
17 0x00000000011b12b5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b12b5)
18 0x0000000000f0b896 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b896)
19 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
20 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
21 0x00007fb4b9cbf830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
22 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-25 00:26:28 +01:00
practicalswift
8940814fd4 [swiftc (43 vs. 5433)] Add crasher in swift::constraints::ConstraintGraph::lookupNode(...)
Add test case for crash triggered in `swift::constraints::ConstraintGraph::lookupNode(...)`.

Current number of unresolved compiler crashers: 43 (5433 resolved)

/cc @DougGregor - just wanted to let you know that this crasher caused an assertion failure for the assertion `TypeVariables[impl.getGraphIndex()] == typeVar && "Type variable mismatch"` added on 2013-12-09 by you in commit 11794095 :-)

Assertion failure in [`lib/Sema/ConstraintGraph.cpp (line 52)`](fa59a29371/lib/Sema/ConstraintGraph.cpp (L52)):

```
Assertion `TypeVariables[impl.getGraphIndex()] == typeVar && "Type variable mismatch"' failed.

When executing: std::pair<ConstraintGraphNode &, unsigned int> swift::constraints::ConstraintGraph::lookupNode(swift::TypeVariableType *)
```

Assertion context:

```c++
  // Check whether we've already created a node for this type variable.
  auto &impl = typeVar->getImpl();
  if (auto nodePtr = impl.getGraphNode()) {
    assert(impl.getGraphIndex() < TypeVariables.size() && "Out-of-bounds index");
    assert(TypeVariables[impl.getGraphIndex()] == typeVar &&
           "Type variable mismatch");
    return { *nodePtr, impl.getGraphIndex() };
  }

  // Allocate the new node.
  auto nodePtr = new ConstraintGraphNode(typeVar);
```
Stack trace:

```
0 0x000000000389c558 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x389c558)
1 0x000000000389cc96 SignalHandler(int) (/path/to/swift/bin/swift+0x389cc96)
2 0x00007fea6858d3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fea66ef3428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fea66ef502a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007fea66eebbd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007fea66eebc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000001241c2d swift::constraints::ConstraintGraph::lookupNode(swift::TypeVariableType*) (/path/to/swift/bin/swift+0x1241c2d)
8 0x00000000012435cf swift::constraints::ConstraintGraph::addConstraint(swift::constraints::Constraint*) (/path/to/swift/bin/swift+0x12435cf)
9 0x0000000001215ff9 swift::constraints::ConstraintSystem::addUnsolvedConstraint(swift::constraints::Constraint*) (/path/to/swift/bin/swift+0x1215ff9)
10 0x0000000001211420 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) (/path/to/swift/bin/swift+0x1211420)
11 0x000000000121e4c8 swift::constraints::ConstraintSystem::addConstraintImpl(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) (/path/to/swift/bin/swift+0x121e4c8)
12 0x000000000121641e swift::constraints::ConstraintSystem::addConstraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) (/path/to/swift/bin/swift+0x121641e)
13 0x0000000001250b7d swift::constraints::ConstraintSystem::getTypeOfReference(swift::ValueDecl*, bool, bool, swift::FunctionRefKind, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*) (/path/to/swift/bin/swift+0x1250b7d)
14 0x000000000125344e swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) (/path/to/swift/bin/swift+0x125344e)
15 0x00000000012f86c8 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x12f86c8)
16 0x00000000012fccc8 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x12fccc8)
17 0x00000000013a6937 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a6937)
18 0x00000000013a52cb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a52cb)
19 0x00000000012f4aa8 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) (/path/to/swift/bin/swift+0x12f4aa8)
20 0x0000000001226afd swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) (/path/to/swift/bin/swift+0x1226afd)
21 0x0000000001281b64 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>) (/path/to/swift/bin/swift+0x1281b64)
22 0x0000000001285706 swift::TypeChecker::getTypeOfExpressionWithoutApplying(swift::Expr*&, swift::DeclContext*, swift::ConcreteDeclRef&, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*) (/path/to/swift/bin/swift+0x1285706)
23 0x00000000012005b3 (anonymous namespace)::FailureDiagnosis::diagnoseAmbiguousMultiStatementClosure(swift::ClosureExpr*) (/path/to/swift/bin/swift+0x12005b3)
24 0x00000000012058f1 std::_Function_handler<swift::Expr* (swift::Expr*), (anonymous namespace)::FailureDiagnosis::diagnoseAmbiguity(swift::Expr*)::$_18>::_M_invoke(std::_Any_data const&, swift::Expr*&&) (/path/to/swift/bin/swift+0x12058f1)
25 0x00000000013e6107 swift::Expr::forEachChildExpr(std::function<swift::Expr* (swift::Expr*)> const&)::ChildWalker::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x13e6107)
26 0x00000000013a5ec6 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a5ec6)
27 0x00000000013a645c swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a645c)
28 0x00000000013a8317 (anonymous namespace)::Traversal::visitCollectionExpr(swift::CollectionExpr*) (/path/to/swift/bin/swift+0x13a8317)
29 0x00000000013a52cb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a52cb)
30 0x00000000013decc8 swift::Expr::forEachChildExpr(std::function<swift::Expr* (swift::Expr*)> const&) (/path/to/swift/bin/swift+0x13decc8)
31 0x00000000011dea72 (anonymous namespace)::FailureDiagnosis::diagnoseAmbiguity(swift::Expr*) (/path/to/swift/bin/swift+0x11dea72)
32 0x00000000011d92c7 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11d92c7)
33 0x00000000011dffcd swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11dffcd)
34 0x0000000001281ba8 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>) (/path/to/swift/bin/swift+0x1281ba8)
35 0x00000000012851d6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x12851d6)
36 0x00000000011e4d66 (anonymous namespace)::FailureDiagnosis::typeCheckChildIndependently(swift::Expr*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<TCCFlags, unsigned int>, swift::ExprTypeCheckListener*, bool) (/path/to/swift/bin/swift+0x11e4d66)
37 0x0000000001203d1b (anonymous namespace)::FailureDiagnosis::typeCheckArbitrarySubExprIndependently(swift::Expr*, swift::OptionSet<TCCFlags, unsigned int>) (/path/to/swift/bin/swift+0x1203d1b)
38 0x00000000011dc9c5 (anonymous namespace)::FailureDiagnosis::diagnoseConstraintFailure() (/path/to/swift/bin/swift+0x11dc9c5)
39 0x00000000011d92b6 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11d92b6)
40 0x00000000011dffcd swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11dffcd)
41 0x0000000001281ba8 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>) (/path/to/swift/bin/swift+0x1281ba8)
42 0x00000000012851d6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x12851d6)
43 0x000000000119bb7e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119bb7e)
44 0x000000000119b3a6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x119b3a6)
45 0x00000000011b1220 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b1220)
46 0x0000000000f0b896 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b896)
47 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
48 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
49 0x00007fea66ede830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
50 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-24 23:35:40 +01:00
practicalswift
73771919d5 [swiftc (42 vs. 5433)] Add crasher in swift::constraints::ConstraintGraph::addConstraint(...)
Add test case for crash triggered in `swift::constraints::ConstraintGraph::addConstraint(...)`.

Current number of unresolved compiler crashers: 42 (5433 resolved)

/cc @DougGregor - just wanted to let you know that this crasher caused an assertion failure for the assertion `impl.getGraphIndex() < TypeVariables.size() && "Out-of-bounds index"` added on 2013-12-09 by you in commit 11794095 :-)

Assertion failure in [`lib/Sema/ConstraintGraph.cpp (line 50)`](de771d3819/lib/Sema/ConstraintGraph.cpp (L50)):

```
Assertion `impl.getGraphIndex() < TypeVariables.size() && "Out-of-bounds index"' failed.

When executing: std::pair<ConstraintGraphNode &, unsigned int> swift::constraints::ConstraintGraph::lookupNode(swift::TypeVariableType *)
```

Assertion context:

```c++
std::pair<ConstraintGraphNode &, unsigned>
ConstraintGraph::lookupNode(TypeVariableType *typeVar) {
  // Check whether we've already created a node for this type variable.
  auto &impl = typeVar->getImpl();
  if (auto nodePtr = impl.getGraphNode()) {
    assert(impl.getGraphIndex() < TypeVariables.size() && "Out-of-bounds index");
    assert(TypeVariables[impl.getGraphIndex()] == typeVar &&
           "Type variable mismatch");
    return { *nodePtr, impl.getGraphIndex() };
  }

```
Stack trace:

```
0 0x000000000389c558 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x389c558)
1 0x000000000389cc96 SignalHandler(int) (/path/to/swift/bin/swift+0x389cc96)
2 0x00007ff75781e3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007ff756184428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007ff75618602a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007ff75617cbd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007ff75617cc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000001241e09 (/path/to/swift/bin/swift+0x1241e09)
8 0x00000000012435cf swift::constraints::ConstraintGraph::addConstraint(swift::constraints::Constraint*) (/path/to/swift/bin/swift+0x12435cf)
9 0x0000000001215ff9 swift::constraints::ConstraintSystem::addUnsolvedConstraint(swift::constraints::Constraint*) (/path/to/swift/bin/swift+0x1215ff9)
10 0x0000000001211420 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) (/path/to/swift/bin/swift+0x1211420)
11 0x000000000121e4c8 swift::constraints::ConstraintSystem::addConstraintImpl(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) (/path/to/swift/bin/swift+0x121e4c8)
12 0x000000000121641e swift::constraints::ConstraintSystem::addConstraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) (/path/to/swift/bin/swift+0x121641e)
13 0x0000000001250b7d swift::constraints::ConstraintSystem::getTypeOfReference(swift::ValueDecl*, bool, bool, swift::FunctionRefKind, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*) (/path/to/swift/bin/swift+0x1250b7d)
14 0x000000000125344e swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) (/path/to/swift/bin/swift+0x125344e)
15 0x00000000012f86c8 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x12f86c8)
16 0x00000000012fccc8 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x12fccc8)
17 0x00000000013a6937 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a6937)
18 0x00000000013a52cb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a52cb)
19 0x00000000012f4aa8 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) (/path/to/swift/bin/swift+0x12f4aa8)
20 0x0000000001226afd swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) (/path/to/swift/bin/swift+0x1226afd)
21 0x0000000001281b64 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>) (/path/to/swift/bin/swift+0x1281b64)
22 0x0000000001285706 swift::TypeChecker::getTypeOfExpressionWithoutApplying(swift::Expr*&, swift::DeclContext*, swift::ConcreteDeclRef&, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*) (/path/to/swift/bin/swift+0x1285706)
23 0x00000000012005b3 (anonymous namespace)::FailureDiagnosis::diagnoseAmbiguousMultiStatementClosure(swift::ClosureExpr*) (/path/to/swift/bin/swift+0x12005b3)
24 0x00000000012058f1 std::_Function_handler<swift::Expr* (swift::Expr*), (anonymous namespace)::FailureDiagnosis::diagnoseAmbiguity(swift::Expr*)::$_18>::_M_invoke(std::_Any_data const&, swift::Expr*&&) (/path/to/swift/bin/swift+0x12058f1)
25 0x00000000013e6107 swift::Expr::forEachChildExpr(std::function<swift::Expr* (swift::Expr*)> const&)::ChildWalker::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x13e6107)
26 0x00000000013a5ec6 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a5ec6)
27 0x00000000013a85be (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0x13a85be)
28 0x00000000013a65a2 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a65a2)
29 0x00000000013a85be (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0x13a85be)
30 0x00000000013a5ef8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a5ef8)
31 0x00000000013a52cb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a52cb)
32 0x00000000013decc8 swift::Expr::forEachChildExpr(std::function<swift::Expr* (swift::Expr*)> const&) (/path/to/swift/bin/swift+0x13decc8)
33 0x00000000011dea72 (anonymous namespace)::FailureDiagnosis::diagnoseAmbiguity(swift::Expr*) (/path/to/swift/bin/swift+0x11dea72)
34 0x00000000011d92c7 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11d92c7)
35 0x00000000011dffcd swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11dffcd)
36 0x0000000001281ba8 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>) (/path/to/swift/bin/swift+0x1281ba8)
37 0x00000000012851d6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x12851d6)
38 0x000000000119bb7e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119bb7e)
39 0x000000000119b3a6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x119b3a6)
40 0x00000000011b1220 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11b1220)
41 0x0000000000f0b896 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b896)
42 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
43 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
44 0x00007ff75616f830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
45 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-24 22:40:05 +01:00
Slava Pestov
8109cf7187 Add regression test for a bug that's already been fixed 2017-01-23 23:54:50 -08:00
Slava Pestov
55c0e7401c Sema: Fix crash when @noescape or @autoclosure is applied to parameter
In Swift 3, these attributes were changed to apply to the type,
and not the parameter. If they appear on the parameter, we would
go down a diagnostic code path.

When checking a generic function signature, we might not have a
contextual type for the parameter yet, so bail out instead of
crashing.
2017-01-23 23:54:50 -08:00
Slava Pestov
a67f4bdff4 Merge pull request #6948 from matthewcarroll/SR-3599-Better-Recovery-For-Decl-Names
[DiagnosticsQoI] SR-3599: Better recovery for decls with consecutive identifiers
2017-01-23 17:37:07 -08:00
Max Moiseev
b5ab7263c1 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-23 11:00:33 -08:00
swift-ci
d36aa736d2 Merge pull request #6983 from rintaro/crasher-nondeterministic-28657 2017-01-23 03:37:17 -08:00
Rintaro Ishizaki
12f0184162 Disable a non-deterministic crasher 2017-01-23 20:03:22 +09:00
practicalswift
d539a2fca8 [swiftc (43 vs. 5431)] Add crasher in swift::Expr::walk(...)
Add test case for crash triggered in `swift::Expr::walk(...)`.

Current number of unresolved compiler crashers: 43 (5431 resolved)

Assertion failure in `llvm/include/llvm/Support/Casting.h (line 236)`:

```
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

When executing: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::MetatypeType, Y = swift::TypeBase]
```

Assertion context:

```c++
                          typename simplify_type<Y>::SimpleType>::doit(Val);
}

template <class X, class Y>
inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
  assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
  return cast_convert_val<X, Y*,
                          typename simplify_type<Y*>::SimpleType>::doit(Val);
}

// cast_or_null<X> - Functionally identical to cast, except that a null value is
```
Stack trace:

```
0 0x0000000003898388 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3898388)
1 0x0000000003898ac6 SignalHandler(int) (/path/to/swift/bin/swift+0x3898ac6)
2 0x00007fe9598343e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fe95819a428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fe95819c02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007fe958192bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007fe958192c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000011b8759 (anonymous namespace)::ExprRewriter::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::Optional<swift::Pattern*>) (/path/to/swift/bin/swift+0x11b8759)
8 0x00000000011d0476 (anonymous namespace)::ExprRewriter::coerceCallArguments(swift::Expr*, swift::Type, llvm::PointerUnion<swift::ApplyExpr*, llvm::PointerEmbeddedInt<unsigned int, 2> >, llvm::ArrayRef<swift::Identifier>, bool, swift::constraints::ConstraintLocatorBuilder) (/path/to/swift/bin/swift+0x11d0476)
9 0x00000000011bbcf1 (anonymous namespace)::ExprRewriter::finishApply(swift::ApplyExpr*, swift::Type, swift::constraints::ConstraintLocatorBuilder) (/path/to/swift/bin/swift+0x11bbcf1)
10 0x00000000011bc74b (anonymous namespace)::ExprRewriter::finishApply(swift::ApplyExpr*, swift::Type, swift::constraints::ConstraintLocatorBuilder) (/path/to/swift/bin/swift+0x11bc74b)
11 0x00000000011d1a43 (anonymous namespace)::ExprRewriter::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0x11d1a43)
12 0x00000000011b8cc4 (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x11b8cc4)
13 0x00000000011bdda1 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x11bdda1)
14 0x00000000013a545c swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a545c)
15 0x00000000011b5b88 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) (/path/to/swift/bin/swift+0x11b5b88)
16 0x0000000001283f80 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1283f80)
17 0x00000000011e3886 (anonymous namespace)::FailureDiagnosis::typeCheckChildIndependently(swift::Expr*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<TCCFlags, unsigned int>, swift::ExprTypeCheckListener*, bool) (/path/to/swift/bin/swift+0x11e3886)
18 0x00000000011d7e87 (anonymous namespace)::FailureDiagnosis::diagnoseContextualConversionError() (/path/to/swift/bin/swift+0x11d7e87)
19 0x00000000011d7db8 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11d7db8)
20 0x00000000011deaed swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11deaed)
21 0x00000000012808c8 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>) (/path/to/swift/bin/swift+0x12808c8)
22 0x0000000001283ef6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1283ef6)
23 0x000000000119bc51 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119bc51)
24 0x000000000119a78d swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x119a78d)
25 0x0000000001198acf swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x1198acf)
26 0x0000000001198902 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/path/to/swift/bin/swift+0x1198902)
27 0x00000000011996ec swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/path/to/swift/bin/swift+0x11996ec)
28 0x00000000011af259 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11af259)
29 0x00000000011affc5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11affc5)
30 0x0000000000f0b546 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b546)
31 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
32 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
33 0x00007fe958185830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
34 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-23 11:17:33 +01:00
practicalswift
4b65f5c62c [swiftc (42 vs. 5431)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 42 (5431 resolved)

Stack trace:

```
0 0x0000000003898388 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3898388)
1 0x0000000003898ac6 SignalHandler(int) (/path/to/swift/bin/swift+0x3898ac6)
2 0x00007f946de6a3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x0000000001421d71 swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x1421d71)
4 0x000000000127a200 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x127a200)
5 0x000000000127a66a (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127a66a)
6 0x00000000013a663e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a663e)
7 0x00000000013a543b swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a543b)
8 0x000000000127b680 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127b680)
9 0x00000000013a58fe (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a58fe)
10 0x00000000013a8ab8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13a8ab8)
11 0x00000000013a54be swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a54be)
12 0x00000000012793e0 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x12793e0)
13 0x00000000011af7eb typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11af7eb)
14 0x00000000011affc5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11affc5)
15 0x0000000000f0b546 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b546)
16 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
17 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
18 0x00007f946c7bb830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
19 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-23 10:24:34 +01:00
Matthew Carroll
6285579855 Remove the expectation of this test crashing, and move it into the compiler crashers fixed test suite.
The crash was fixed accidentally in 93a7a9f80d.
2017-01-22 13:20:04 -05:00
practicalswift
c5a3e47978 [swiftc (41 vs. 5431)] Add crasher in swift::DiagnosticEngine::emitDiagnostic
Add test case for crash triggered in `swift::DiagnosticEngine::emitDiagnostic`.

Current number of unresolved compiler crashers: 41 (5431 resolved)

/cc @jtbandes - just wanted to let you know that this crasher caused an assertion failure for the assertion `false && "encountered %error in diagnostic text"` added on 2016-11-19 by you in commit 32635696 :-)

Assertion failure in [`lib/AST/DiagnosticEngine.cpp (line 490)`](e9dd8107a9/lib/AST/DiagnosticEngine.cpp (L490)):

```
Assertion `false && "encountered %error in diagnostic text"' failed.

When executing: void formatDiagnosticText(llvm::StringRef, ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream &)
```

Assertion context:

```c++
      Modifier = InText.substr(0, Length);
      InText = InText.substr(Length);
    }

    if (Modifier == "error") {
      assert(false && "encountered %error in diagnostic text");
      Out << StringRef("<<ERROR>>");
      break;
    }

    // Parse the optional argument list for a modifier, which is brace-enclosed.
```
Stack trace:

```
0 0x0000000003898168 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3898168)
1 0x00000000038988a6 SignalHandler(int) (/path/to/swift/bin/swift+0x38988a6)
2 0x00007f72dbbc53e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f72da52b428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f72da52d02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f72da523bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f72da523c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000013da017 formatDiagnosticText(llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream&) (/path/to/swift/bin/swift+0x13da017)
8 0x00000000013d8df7 formatDiagnosticText(llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream&) (/path/to/swift/bin/swift+0x13d8df7)
9 0x00000000013d80d0 swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) (/path/to/swift/bin/swift+0x13d80d0)
10 0x00000000013d741f swift::DiagnosticEngine::flushActiveDiagnostic() (/path/to/swift/bin/swift+0x13d741f)
11 0x000000000130ab3e swift::ASTVisitor<(anonymous namespace)::AttributeChecker, void, void, void, void, void, void>::visit(swift::DeclAttribute*) (/path/to/swift/bin/swift+0x130ab3e)
12 0x0000000001309741 swift::TypeChecker::checkDeclAttributes(swift::Decl*) (/path/to/swift/bin/swift+0x1309741)
13 0x0000000001299530 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1299530)
14 0x00000000012a6b9b (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) (/path/to/swift/bin/swift+0x12a6b9b)
15 0x00000000012993b4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x12993b4)
16 0x00000000012992e3 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) (/path/to/swift/bin/swift+0x12992e3)
17 0x00000000011afe05 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11afe05)
18 0x0000000000f0b546 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b546)
19 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
20 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
21 0x00007f72da516830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
22 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-22 10:38:34 +01:00
practicalswift
e9dd8107a9 Merge pull request #6964 from practicalswift/gardening-20170121
[gardening] Typos. NULL → nullptr. \t. Incorrect Doxygen. Redundant REQUIRES. Unused diagnostics. PEP-8.
2017-01-22 01:22:34 +01:00
practicalswift
3c02055959 [swiftc (40 vs. 5431)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 40 (5431 resolved)

Assertion failure in [`include/swift/AST/Type.h (line 362)`](4a7d0c00e0/include/swift/AST/Type.h (L362)):

```
Assertion `isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"' failed.

When executing: swift::CanType::CanType(swift::TypeBase *)
```

Assertion context:

```c++
  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 0x0000000003897f68 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3897f68)
1 0x00000000038986a6 SignalHandler(int) (/path/to/swift/bin/swift+0x38986a6)
2 0x00007f8333f4f3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f83328b5428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f83328b702a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f83328adbd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f83328adc82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000001422309 swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x1422309)
8 0x0000000001279f50 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x1279f50)
9 0x000000000127a3ba (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127a3ba)
10 0x00000000013a637e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a637e)
11 0x00000000013a517b swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a517b)
12 0x000000000127b3d0 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127b3d0)
13 0x00000000013a563e (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a563e)
14 0x00000000013a87f8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13a87f8)
15 0x00000000013a51fe swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a51fe)
16 0x0000000001279130 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x1279130)
17 0x00000000011af53b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11af53b)
18 0x00000000011afd15 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11afd15)
19 0x0000000000f0b446 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b446)
20 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
21 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
22 0x00007f83328a0830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
23 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-21 13:17:33 +01:00
practicalswift
4382842f9a [swiftc (39 vs. 5431)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 39 (5431 resolved)

/cc @lattner - just wanted to let you know that this crasher caused an assertion failure for the assertion `Result && "Case not implemented!"` added on 2011-03-22 by you in commit fd2bf74f :-)

Assertion failure in [`lib/AST/Type.cpp (line 1299)`](9cc9ae03f6/lib/AST/Type.cpp (L1299)):

```
Assertion `Result && "Case not implemented!"' failed.

When executing: swift::CanType swift::TypeBase::getCanonicalType()
```

Assertion context:

```c++
  }
  }

  // Cache the canonical type for future queries.
  assert(Result && "Case not implemented!");
  CanonicalType = Result;
  return CanType(Result);
}

```
Stack trace:

```
0 0x0000000003897f68 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3897f68)
1 0x00000000038986a6 SignalHandler(int) (/path/to/swift/bin/swift+0x38986a6)
2 0x00007f4e689fb3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f4e67361428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f4e6736302a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f4e67359bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f4e67359c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000001422328 swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x1422328)
8 0x0000000001279f50 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x1279f50)
9 0x000000000127a3ba (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x127a3ba)
10 0x00000000013a637e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a637e)
11 0x00000000013a517b swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a517b)
12 0x000000000127b3d0 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x127b3d0)
13 0x00000000013a563e (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a563e)
14 0x00000000013a87f8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13a87f8)
15 0x00000000013a51fe swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a51fe)
16 0x0000000001279130 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x1279130)
17 0x00000000011af53b typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11af53b)
18 0x00000000011afd15 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11afd15)
19 0x0000000000f0b446 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b446)
20 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
21 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
22 0x00007f4e6734c830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
23 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-21 12:26:19 +01:00
practicalswift
8fcffd6bb5 [swiftc (38 vs. 5431)] Add crasher in swift::Type::findIf
Add test case for crash triggered in `swift::Type::findIf`.

Current number of unresolved compiler crashers: 38 (5431 resolved)

Stack trace:

```
0 0x0000000003897f68 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3897f68)
1 0x00000000038986a6 SignalHandler(int) (/path/to/swift/bin/swift+0x38986a6)
2 0x00007fd038cef3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fd037655428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fd03765702a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00000000038344bd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) (/path/to/swift/bin/swift+0x38344bd)
6 0x000000000142649d (/path/to/swift/bin/swift+0x142649d)
7 0x0000000001399500 bool llvm::function_ref<bool (swift::Type)>::callback_fn<(anonymous namespace)::Verifier::verifyChecked(swift::Type, llvm::SmallPtrSet<swift::ArchetypeType*, 4u>&)::{lambda(swift::Type)#1}>(long, swift::Type) (/path/to/swift/bin/swift+0x1399500)
8 0x000000000142f31b swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const::Walker::walkToTypePre(swift::Type) (/path/to/swift/bin/swift+0x142f31b)
9 0x00000000014373a5 swift::Type::walk(swift::TypeWalker&) const (/path/to/swift/bin/swift+0x14373a5)
10 0x00000000014232c2 swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const (/path/to/swift/bin/swift+0x14232c2)
11 0x0000000001399472 (anonymous namespace)::Verifier::verifyChecked(swift::Type, llvm::SmallPtrSet<swift::ArchetypeType*, 4u>&) (/path/to/swift/bin/swift+0x1399472)
12 0x000000000138e044 (anonymous namespace)::Verifier::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x138e044)
13 0x00000000013a63c5 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a63c5)
14 0x00000000013a833d (anonymous namespace)::Traversal::visitParameterList(swift::ParameterList*) (/path/to/swift/bin/swift+0x13a833d)
15 0x00000000013ab09c (anonymous namespace)::Traversal::visitAbstractFunctionDecl(swift::AbstractFunctionDecl*) (/path/to/swift/bin/swift+0x13ab09c)
16 0x00000000013a569f (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a569f)
17 0x00000000013a5594 swift::Decl::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a5594)
18 0x000000000140106e swift::SourceFile::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x140106e)
19 0x000000000138d6f5 swift::verify(swift::SourceFile&) (/path/to/swift/bin/swift+0x138d6f5)
20 0x00000000011afe24 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11afe24)
21 0x0000000000f0b446 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b446)
22 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
23 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
24 0x00007fd037640830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
25 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-21 11:30:25 +01:00
practicalswift
23d53a3a4a Remove REQUIRES annotation from fixed crashers. 2017-01-21 10:32:59 +01:00
Bob Wilson
47ca65578f Merge pull request #6951 from bob-wilson/disable-crasher
Disable a compiler_crasher test that is non-deterministic.
2017-01-20 11:56:36 -08:00
Bob Wilson
8c956c6f07 Disable a compiler_crasher test that is non-deterministic.
The 28616-swift-parser-parseexprsequence-swift-diag-bool-bool.swift test
crashes due to a stack overflow. I had previously disabled it to get
through a master-next merge, so this just leaves it disabled. The only
change is to replace the Radar number with a better reason for why it is
disabled.
2017-01-20 10:01:54 -08:00
practicalswift
da38670355 [swiftc (37 vs. 5431)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 37 (5431 resolved)

Stack trace:

```
0 0x0000000003896a88 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3896a88)
1 0x00000000038971c6 SignalHandler(int) (/path/to/swift/bin/swift+0x38971c6)
2 0x00007f1505e023e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f1504768428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f150476a02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x0000000003832fdd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) (/path/to/swift/bin/swift+0x3832fdd)
6 0x00000000014214af swift::TypeBase::getCanonicalType() (/path/to/swift/bin/swift+0x14214af)
7 0x0000000001278990 (anonymous namespace)::FindCapturedVars::checkType(swift::Type, swift::SourceLoc) (/path/to/swift/bin/swift+0x1278990)
8 0x0000000001278dfa (anonymous namespace)::FindCapturedVars::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x1278dfa)
9 0x00000000013a54be swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a54be)
10 0x00000000013a42bb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a42bb)
11 0x0000000001279e10 (anonymous namespace)::FindCapturedVars::walkToDeclPre(swift::Decl*) (/path/to/swift/bin/swift+0x1279e10)
12 0x00000000013a477e (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a477e)
13 0x00000000013a9d34 (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) (/path/to/swift/bin/swift+0x13a9d34)
14 0x00000000013a47cb (anonymous namespace)::Traversal::doIt(swift::Decl*) (/path/to/swift/bin/swift+0x13a47cb)
15 0x00000000013a7938 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x13a7938)
16 0x00000000013a433e swift::Stmt::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a433e)
17 0x0000000001277b70 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) (/path/to/swift/bin/swift+0x1277b70)
18 0x00000000011aebdb typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/path/to/swift/bin/swift+0x11aebdb)
19 0x00000000011af3b5 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11af3b5)
20 0x0000000000f0b076 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b076)
21 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
22 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
23 0x00007f1504753830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
24 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-20 18:34:30 +01:00
practicalswift
5f7dba7964 [swiftc (36 vs. 5431)] Add crasher in swift::Expr::walk(...)
Add test case for crash triggered in `swift::Expr::walk(...)`.

Current number of unresolved compiler crashers: 36 (5431 resolved)

/cc @slavapestov - just wanted to let you know that this crasher caused an assertion failure for the assertion `!base || !base->hasTypeParameter()` added on 2016-12-25 by you in commit 71df32fd :-)

Assertion failure in [`lib/Sema/OverloadChoice.h (line 108)`](9bdd3d216d/lib/Sema/OverloadChoice.h (L108)):

```
Assertion `!base || !base->hasTypeParameter()' failed.

When executing: swift::constraints::OverloadChoice::OverloadChoice(swift::Type, swift::ValueDecl *, bool, swift::FunctionRefKind)
```

Assertion context:

```c++

  OverloadChoice(Type base, ValueDecl *value, bool isSpecialized,
                 FunctionRefKind functionRefKind)
    : BaseAndBits(base, isSpecialized ? IsSpecializedBit : 0),
      TheFunctionRefKind(functionRefKind) {
    assert(!base || !base->hasTypeParameter());
    assert((reinterpret_cast<uintptr_t>(value) & (uintptr_t)0x03) == 0 &&
           "Badly aligned decl");

    DeclOrKind = reinterpret_cast<uintptr_t>(value);
  }
```
Stack trace:

```
0 0x0000000003896a88 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3896a88)
1 0x00000000038971c6 SignalHandler(int) (/path/to/swift/bin/swift+0x38971c6)
2 0x00007fde322143e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fde30b7a428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fde30b7c02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007fde30b72bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007fde30b72c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000012fd16a (/path/to/swift/bin/swift+0x12fd16a)
8 0x00000000012fa358 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) (/path/to/swift/bin/swift+0x12fa358)
9 0x00000000013a755c (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/path/to/swift/bin/swift+0x13a755c)
10 0x00000000013a7307 (anonymous namespace)::Traversal::visitCollectionExpr(swift::CollectionExpr*) (/path/to/swift/bin/swift+0x13a7307)
11 0x00000000013a42bb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a42bb)
12 0x00000000012f2348 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) (/path/to/swift/bin/swift+0x12f2348)
13 0x0000000001224c0d swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) (/path/to/swift/bin/swift+0x1224c0d)
14 0x000000000127f014 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>) (/path/to/swift/bin/swift+0x127f014)
15 0x0000000001282686 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1282686)
16 0x00000000011e2e56 (anonymous namespace)::FailureDiagnosis::typeCheckChildIndependently(swift::Expr*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<TCCFlags, unsigned int>, swift::ExprTypeCheckListener*, bool) (/path/to/swift/bin/swift+0x11e2e56)
17 0x0000000001201e1b (anonymous namespace)::FailureDiagnosis::typeCheckArbitrarySubExprIndependently(swift::Expr*, swift::OptionSet<TCCFlags, unsigned int>) (/path/to/swift/bin/swift+0x1201e1b)
18 0x00000000011daaa5 (anonymous namespace)::FailureDiagnosis::diagnoseConstraintFailure() (/path/to/swift/bin/swift+0x11daaa5)
19 0x00000000011d7396 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11d7396)
20 0x00000000011de0bd swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11de0bd)
21 0x000000000127f058 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>) (/path/to/swift/bin/swift+0x127f058)
22 0x0000000001282686 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1282686)
23 0x0000000001199c5e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x1199c5e)
24 0x0000000001199476 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x1199476)
25 0x00000000011af320 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11af320)
26 0x0000000000f0b076 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b076)
27 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
28 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
29 0x00007fde30b65830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
30 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-20 17:43:16 +01:00
practicalswift
59bd9cf0e2 [swiftc (35 vs. 5431)] Add crasher in swift::constraints::ConstraintSystem::getType
Add test case for crash triggered in `swift::constraints::ConstraintSystem::getType`.

Current number of unresolved compiler crashers: 35 (5431 resolved)

/cc @rudkx - just wanted to let you know that this crasher caused an assertion failure for the assertion `hasType(E) && "Expected type to have been set!"` added on 2016-12-11 by you in commit 1139f872 :-)

Assertion failure in [`lib/Sema/ConstraintSystem.h (line 1464)`](229e2c339a/lib/Sema/ConstraintSystem.h (L1464)):

```
Assertion `hasType(E) && "Expected type to have been set!"' failed.

When executing: swift::Type swift::constraints::ConstraintSystem::getType(const swift::Expr *) const
```

Assertion context:

```c++
            E->getType()->isEqual(ExprTypes.find(E)->second)) &&
           "Mismatched types!");
    return ExprTypes.find(E)->second;
  }

  /// Cache the type of the expression argument and return that same
  /// argument.
  template <typename T>
  T *cacheType(T *E) {
    assert(E->getType() && "Expected a type!");
    setType(E, E->getType());
```
Stack trace:

```
0 0x0000000003896a88 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3896a88)
1 0x00000000038971c6 SignalHandler(int) (/path/to/swift/bin/swift+0x38971c6)
2 0x00007fce42f3c3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007fce418a2428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007fce418a402a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007fce4189abd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007fce4189ac82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000011b3921 swift::constraints::ConstraintSystem::getType(swift::Expr const*) const (/path/to/swift/bin/swift+0x11b3921)
8 0x00000000012fb254 (anonymous namespace)::ConstraintOptimizer::walkToExprPre(swift::Expr*) (/path/to/swift/bin/swift+0x12fb254)
9 0x00000000013a5568 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) (/path/to/swift/bin/swift+0x13a5568)
10 0x00000000013a42bb swift::Expr::walk(swift::ASTWalker&) (/path/to/swift/bin/swift+0x13a42bb)
11 0x00000000012f3140 swift::constraints::ConstraintSystem::optimizeConstraints(swift::Expr*) (/path/to/swift/bin/swift+0x12f3140)
12 0x0000000001216747 swift::constraints::ConstraintSystem::performMemberLookup(swift::constraints::ConstraintKind, swift::DeclName, swift::Type, swift::FunctionRefKind, swift::constraints::ConstraintLocator*, bool) (/path/to/swift/bin/swift+0x1216747)
13 0x00000000011da783 (anonymous namespace)::FailureDiagnosis::diagnoseConstraintFailure() (/path/to/swift/bin/swift+0x11da783)
14 0x00000000011d7396 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) (/path/to/swift/bin/swift+0x11d7396)
15 0x00000000011de0bd swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) (/path/to/swift/bin/swift+0x11de0bd)
16 0x000000000127f058 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>) (/path/to/swift/bin/swift+0x127f058)
17 0x0000000001282686 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/path/to/swift/bin/swift+0x1282686)
18 0x0000000001199c5e swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/path/to/swift/bin/swift+0x1199c5e)
19 0x0000000001199476 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x1199476)
20 0x00000000011af320 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11af320)
21 0x0000000000f0b076 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b076)
22 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
23 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
24 0x00007fce4188d830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
25 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
2017-01-20 16:51:09 +01:00
Max Moiseev
d128ed42b0 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-19 14:16:32 -08:00
Pavel Yaskevich
671d470322 [Diagnostics] Don't attempt member lookup if base type has unresolved type parameters
If there are unresolved generic parameters present and we are trying
to diagnose problems related to initializer call, it makes sense to
check argument expression first, which might be erroneous and then move
on to the ambiguity checking instead of trying to lookup possible
constructors directly.
2017-01-19 14:01:57 -08:00
Bob Wilson
24a61b5b5d Merge branch 'master-next'
This merge contains the changes to accompany the switch to the new stable
branches of llvm, clang, and compiler-rt that are based on swift-4.0-branch.
2017-01-18 09:22:52 -08:00