Commit Graph

1304 Commits

Author SHA1 Message Date
practicalswift
63a04fa2cd [swiftc (57 vs. 5162)] Add crasher in swift::TypeChecker::resolveIdentifierType(...)
Add test case for crash triggered in `swift::TypeChecker::resolveIdentifierType(...)`.

Current number of unresolved compiler crashers: 57 (5162 resolved)

Stack trace:

```
6  swift           0x00000000033a62bd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
9  swift           0x0000000000f51cb2 swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 162
11 swift           0x0000000000f52d54 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
12 swift           0x0000000000f514e3 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 195
14 swift           0x0000000000f21302 swift::TypeChecker::typeCheckParameterList(swift::ParameterList*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 114
17 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
20 swift           0x0000000000f4b744 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
21 swift           0x0000000000f78aec swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
22 swift           0x0000000000ec9506 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1126
25 swift           0x0000000000f4a52a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
26 swift           0x0000000000f4a38e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
27 swift           0x0000000000f4af63 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
29 swift           0x0000000000f045c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
30 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
32 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
33 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28411-swift-typechecker-resolveidentifiertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28411-swift-typechecker-resolveidentifiertype-b907a1.o
1.	While type-checking 'b' at validation-test/compiler_crashers/28411-swift-typechecker-resolveidentifiertype.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28411-swift-typechecker-resolveidentifiertype.swift:9:25 - line:9:37] RangeText="{func x(n:f.d"
3.	While type-checking 'x' at validation-test/compiler_crashers/28411-swift-typechecker-resolveidentifiertype.swift:9:26
4.	While resolving type f.d at [validation-test/compiler_crashers/28411-swift-typechecker-resolveidentifiertype.swift:9:35 - line:9:37] RangeText="f.d"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-13 09:16:45 +02:00
practicalswift
3aa10e38c7 [swiftc (56 vs. 5162)] Add crasher in swift::TypeChecker::typeCheckDecl(...)
Add test case for crash triggered in `swift::TypeChecker::typeCheckDecl(...)`.

Current number of unresolved compiler crashers: 56 (5162 resolved)

Assertion failure in [`lib/Sema/TypeCheckDecl.cpp (line 4773)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckDecl.cpp#L4773):

```
Assertion `!FD->getType()->hasTypeParameter()' failed.

When executing: void (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl *)
```

Assertion context:

```

    if (FD->isInvalid())
      return;

    // This type check should have created a non-dependent type.
    assert(!FD->getType()->hasTypeParameter());

    validateAttributes(TC, FD);

    // Member functions need some special validation logic.
    if (FD->getDeclContext()->isTypeContext()) {
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:4773: void (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl *): Assertion `!FD->getType()->hasTypeParameter()' failed.
10 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
11 swift           0x0000000000f5dc35 swift::addTrivialAccessorsToStorage(swift::AbstractStorageDecl*, swift::TypeChecker&) + 485
12 swift           0x0000000000f64b2d swift::maybeAddAccessorsToVariable(swift::VarDecl*, swift::TypeChecker&) + 2349
13 swift           0x0000000000ed9f4c swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 2732
14 swift           0x0000000000f6519e swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 398
15 swift           0x0000000000ee5017 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1639
18 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
21 swift           0x0000000000f4a52a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
22 swift           0x0000000000f4a38e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
23 swift           0x0000000000f4af63 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000f045c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
29 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28410-swift-typechecker-typecheckdecl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28410-swift-typechecker-typecheckdecl-96fda3.o
1.	While type-checking 'g' at validation-test/compiler_crashers/28410-swift-typechecker-typecheckdecl.swift:10:1
2.	While type-checking 'A' at validation-test/compiler_crashers/28410-swift-typechecker-typecheckdecl.swift:11:1
3.	While type-checking getter for f at validation-test/compiler_crashers/28410-swift-typechecker-typecheckdecl.swift:11:14
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-12 15:47:45 +02:00
practicalswift
0b94f8143a [swiftc (55 vs. 5162)] Add crasher in swift::GenericEnvironment::mapTypeIntoContext(...)
Add test case for crash triggered in `swift::GenericEnvironment::mapTypeIntoContext(...)`.

Current number of unresolved compiler crashers: 55 (5162 resolved)

Stack trace:

```
4  swift           0x000000000112b26b swift::GenericEnvironment::mapTypeIntoContext(swift::ModuleDecl*, swift::Type) const + 27
10 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
13 swift           0x0000000000f4b744 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
14 swift           0x0000000000f78aec swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
15 swift           0x0000000000ec9506 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1126
17 swift           0x0000000000f4b886 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
18 swift           0x0000000000f0452d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
19 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
21 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
22 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28409-swift-archetypebuilder-maptypeintocontext.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28409-swift-archetypebuilder-maptypeintocontext-ca7bb4.o
1.	While type-checking expression at [validation-test/compiler_crashers/28409-swift-archetypebuilder-maptypeintocontext.swift:9:1 - line:11:6] RangeText="{
2.	While type-checking 'A' at validation-test/compiler_crashers/28409-swift-archetypebuilder-maptypeintocontext.swift:10:1
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-12 14:50:07 +02:00
practicalswift
ccc7c422b6 [swiftc (54 vs. 5162)] Add crasher in swift::TypeChecker::checkInheritanceClause(...)
Add test case for crash triggered in `swift::TypeChecker::checkInheritanceClause(...)`.

Current number of unresolved compiler crashers: 54 (5162 resolved)

Assertion failure in [`lib/AST/GenericEnvironment.cpp (line 58)`](https://github.com/apple/swift/blob/master/lib/AST/GenericEnvironment.cpp#L58):

```
Assertion `!type->hasArchetype() && "not fully substituted"' failed.

When executing: swift::Type swift::GenericEnvironment::mapTypeOutOfContext(swift::ModuleDecl *, swift::Type) const
```

Assertion context:

```
  return ctx.Allocate(bytes, alignof(GenericEnvironment), AllocationArena::Permanent);
}

Type GenericEnvironment::mapTypeOutOfContext(ModuleDecl *M, Type type) const {
  type = type.subst(M, ArchetypeToInterfaceMap, SubstFlags::AllowLoweredTypes);
  assert(!type->hasArchetype() && "not fully substituted");
  return type;
}

Type GenericEnvironment::mapTypeIntoContext(ModuleDecl *M, Type type) const {
  type = type.subst(M, InterfaceToArchetypeMap, SubstFlags::AllowLoweredTypes);
```
Stack trace:

```
swift: /path/to/swift/lib/AST/GenericEnvironment.cpp:58: swift::Type swift::GenericEnvironment::mapTypeOutOfContext(swift::ModuleDecl *, swift::Type) const: Assertion `!type->hasArchetype() && "not fully substituted"' failed.
9  swift           0x0000000000ed8032 swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5442
10 swift           0x0000000000ed9617 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 375
11 swift           0x0000000000ed9570 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 208
14 swift           0x000000000114874d swift::namelookup::lookupVisibleDeclsInModule(swift::ModuleDecl*, llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::pair<llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >) + 1101
15 swift           0x000000000112ec12 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1746
16 swift           0x0000000000f1f652 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
17 swift           0x0000000000ec53fa swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4058
19 swift           0x00000000010aa5bb swift::Expr::walk(swift::ASTWalker&) + 27
20 swift           0x0000000000ec5c80 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>) + 224
21 swift           0x0000000000ec9455 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
24 swift           0x0000000000f4b744 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
25 swift           0x0000000000f78aec swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
26 swift           0x0000000000ec9506 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1126
27 swift           0x0000000000ecd7e0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
28 swift           0x0000000000ecd9d5 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 229
33 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
34 swift           0x0000000000f044c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
35 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
37 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
38 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28408-swift-typechecker-checkinheritanceclause.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28408-swift-typechecker-checkinheritanceclause-0af88b.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28408-swift-typechecker-checkinheritanceclause.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28408-swift-typechecker-checkinheritanceclause.swift:14:1 - line:14:8] RangeText="{func<a}"
3.	While type-checking expression at [validation-test/compiler_crashers/28408-swift-typechecker-checkinheritanceclause.swift:14:7 - line:14:7] RangeText="a"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-12 13:20:26 +02:00
practicalswift
699cc9e626 [swiftc (53 vs. 5162)] Add crasher in swift::GenericSignature::getSubstitutionMap(...)
Add test case for crash triggered in `swift::GenericSignature::getSubstitutionMap(...)`.

Current number of unresolved compiler crashers: 53 (5162 resolved)

Stack trace:

```
4  swift           0x000000000112c2eb swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>, swift::SubstitutionMap&) const + 27
5  swift           0x000000000112c2bf swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 47
6  swift           0x0000000001167a6c swift::TypeBase::getSuperclass(swift::LazyResolver*) + 220
7  swift           0x000000000117b431 swift::ConformanceLookupTable::getConformance(swift::NominalTypeDecl*, swift::LazyResolver*, swift::ConformanceLookupTable::ConformanceEntry*) + 289
9  swift           0x000000000117bb54 swift::ConformanceLookupTable::lookupConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*, swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ProtocolDecl*>*, llvm::SmallVectorImpl<swift::ProtocolConformance*>*, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*) + 692
10 swift           0x000000000115bcb4 swift::DeclContext::getLocalConformances(swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*, bool) const + 212
11 swift           0x0000000000f28ed2 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 338
14 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 swift           0x0000000000f4a52a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
18 swift           0x0000000000f4a38e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
19 swift           0x0000000000f4af63 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
21 swift           0x0000000000f045c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
22 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
24 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
25 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28407-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28407-swift-genericsignature-getsubstitutionmap-4752b5.o
1.	While type-checking 'b' at validation-test/compiler_crashers/28407-swift-genericsignature-getsubstitutionmap.swift:9:19
2.	While type-checking 'A' at validation-test/compiler_crashers/28407-swift-genericsignature-getsubstitutionmap.swift:9:28
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-12 09:35:04 +02:00
practicalswift
49b435e3ac [swiftc (52 vs. 5162)] Add crasher in swift::decomposeParamType(...)
Add test case for crash triggered in `swift::decomposeParamType(...)`.

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

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

```
Assertion `Index < Length && "Invalid index!"' failed.

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

Assertion context:

```

    /// @}
    /// @name Operator Overloads
    /// @{
    const T &operator[](size_t Index) const {
      assert(Index < Length && "Invalid index!");
      return Data[Index];
    }

    /// @}
    /// @name Expensive Operations
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/ArrayRef.h:186: const T &llvm::ArrayRef<swift::ParamDecl *>::operator[](size_t) const [T = swift::ParamDecl *]: Assertion `Index < Length && "Invalid index!"' failed.
8  swift           0x0000000001165954 swift::decomposeParamType(swift::Type, swift::ValueDecl const*, unsigned int) + 708
12 swift           0x0000000000f95819 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
13 swift           0x0000000000f9c09e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
14 swift           0x0000000000ec5d77 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>) + 471
15 swift           0x0000000000ec9455 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
18 swift           0x0000000000f95819 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
19 swift           0x0000000000f9c09e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
20 swift           0x0000000000ec5d77 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>) + 471
21 swift           0x0000000000ec9455 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
26 swift           0x00000000010aa5eb swift::Expr::walk(swift::ASTWalker&) + 75
27 swift           0x000000000112425b swift::Expr::forEachImmediateChildExpr(std::function<swift::Expr* (swift::Expr*)> const&) + 43
29 swift           0x0000000000f95819 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
30 swift           0x0000000000f9c09e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
31 swift           0x0000000000ec5d77 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>) + 471
32 swift           0x0000000000ec9455 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
33 swift           0x0000000000ecd7e0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
34 swift           0x0000000000ecd9d5 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 229
37 swift           0x0000000000edfc26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
39 swift           0x0000000000f4b886 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
40 swift           0x0000000000f0452d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
41 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
43 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
44 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28406-swift-decomposeparamtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28406-swift-decomposeparamtype-072c9e.o
1.	While type-checking declaration 0x65c9410 at validation-test/compiler_crashers/28406-swift-decomposeparamtype.swift:12:1
2.	While type-checking expression at [validation-test/compiler_crashers/28406-swift-decomposeparamtype.swift:12:7 - line:12:10] RangeText="b()?"
3.	While type-checking expression at [validation-test/compiler_crashers/28406-swift-decomposeparamtype.swift:12:7 - line:12:10] RangeText="b()?"
4.	While type-checking expression at [validation-test/compiler_crashers/28406-swift-decomposeparamtype.swift:12:7 - line:12:9] RangeText="b()"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-11 11:22:51 +02:00
practicalswift
09a00d01eb [swiftc (51 vs. 5162)] Add crasher in swift::constraints::ConstraintSystem::resolveOverload(...)
Add test case for crash triggered in `swift::constraints::ConstraintSystem::resolveOverload(...)`.

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

Assertion failure in [`lib/Sema/ConstraintSystem.cpp (line 1592)`](https://github.com/apple/swift/blob/master/lib/Sema/ConstraintSystem.cpp#L1592):

```
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)
```

Assertion context:

```
          return replaceSelfTypeInArchetype(archetype);
        }
        return type;
      });
  }
  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:

```
swift: /path/to/swift/lib/Sema/ConstraintSystem.cpp:1592: void swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator *, swift::Type, swift::constraints::OverloadChoice): Assertion `!refType->hasTypeParameter() && "Cannot have a dependent type here"' failed.
8  swift           0x0000000000f732fc swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) + 4492
9  swift           0x0000000000fe0432 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 882
10 swift           0x0000000000f6e957 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
11 swift           0x0000000000f72109 swift::constraints::ConstraintSystem::addOverloadSet(swift::Type, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::constraints::ConstraintLocator*, swift::constraints::OverloadChoice*) + 377
12 swift           0x0000000000fdf01f swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 623
13 swift           0x0000000000fe0105 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 69
14 swift           0x0000000000f6e957 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
15 swift           0x0000000000fdb76d swift::constraints::ConstraintSystem::simplifyConstructionConstraint(swift::Type, swift::FunctionType*, unsigned int, swift::FunctionRefKind, swift::constraints::ConstraintLocator*) + 557
16 swift           0x0000000000fdfd7b swift::constraints::ConstraintSystem::simplifyApplicableFnConstraint(swift::constraints::Constraint const&) + 907
17 swift           0x0000000000fe0402 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 834
18 swift           0x0000000000f6e957 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
22 swift           0x00000000010aa5eb swift::Expr::walk(swift::ASTWalker&) + 75
23 swift           0x0000000000fbb868 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
24 swift           0x0000000000fe75dd swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 77
25 swift           0x0000000000ec5d33 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>) + 403
26 swift           0x0000000000ec9455 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
29 swift           0x0000000000f4a52a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
30 swift           0x0000000000f4a38e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
31 swift           0x0000000000f4af63 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
33 swift           0x0000000000f045c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
34 swift           0x0000000000c86e69 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007e0947 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
37 swift           0x00000000007a8e08 main + 2984
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28405-swift-constraints-constraintsystem-resolveoverload.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28405-swift-constraints-constraintsystem-resolveoverload-c3526d.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28405-swift-constraints-constraintsystem-resolveoverload.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28405-swift-constraints-constraintsystem-resolveoverload.swift:10:21 - line:10:26] RangeText="{a<T>("
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-09-10 13:52:26 +02:00
Slava Pestov
0c30979f47 Resolve some crashers 2016-09-06 11:52:25 -07:00
Slava Pestov
97d0562913 XFAIL a crasher that no longer crashes with removal of AllArchetypes
The code here should not type check, because we're adding a requirement to
an outer archetype.

I'm working on some changes to ArchetypeBuilder that will make this kind
of thing easier to catch.
2016-08-28 13:59:20 -07:00
practicalswift
0aa73e2770 [swiftc (56 vs. 5156)] Add crasher in swift::GenericSignature::getSubstitutionMap(...)
Add test case for crash triggered in `swift::GenericSignature::getSubstitutionMap(...)`.

Current number of unresolved compiler crashers: 56 (5156 resolved)

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

```
Assertion `!empty()' failed.

When executing: const T &llvm::ArrayRef<swift::Substitution>::front() const [T = swift::Substitution]
```

Assertion context:

```
    /// size - Get the array size.
    size_t size() const { return Length; }

    /// front - Get the first element.
    const T &front() const {
      assert(!empty());
      return Data[0];
    }

    /// back - Get the last element.
    const T &back() const {
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/ArrayRef.h:139: const T &llvm::ArrayRef<swift::Substitution>::front() const [T = swift::Substitution]: Assertion `!empty()' failed.
8  swift           0x000000000111d436 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 566
9  swift           0x0000000000f5a0d0 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 384
10 swift           0x0000000000edcd44 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3284
11 swift           0x0000000000ecfcfe swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5998
12 swift           0x0000000000ed1077 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 375
17 swift           0x0000000001121464 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1188
18 swift           0x0000000000f16652 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
19 swift           0x0000000000ebc96a swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4058
21 swift           0x000000000109a22b swift::Expr::walk(swift::ASTWalker&) + 27
22 swift           0x0000000000ebd1f0 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>) + 224
23 swift           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
24 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
25 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
30 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000f3f67a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
34 swift           0x0000000000f3f4de swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
35 swift           0x0000000000f400a3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
37 swift           0x0000000000efb4a1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
38 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
40 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
41 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28403-swift-genericsignature-getsubstitutionmap-72dd2a.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift:14:22
2.	While type-checking 'b' at validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift:15:1
3.	While type-checking expression at [validation-test/compiler_crashers/28403-swift-genericsignature-getsubstitutionmap.swift:16:7 - line:16:7] RangeText="F"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-25 10:17:20 +02:00
practicalswift
7a02db4ed6 [swiftc (55 vs. 5156)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

Current number of unresolved compiler crashers: 55 (5156 resolved)

Assertion failure in [`include/swift/AST/Type.h (line 241)`](https://github.com/apple/swift/blob/master/include/swift/AST/Type.h#L241):

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

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

Assertion context:

```
  static CanType getLValueOrInOutObjectTypeImpl(CanType type);
  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:

```
swift: /path/to/swift/include/swift/AST/Type.h:241: swift::CanType::CanType(swift::TypeBase *): Assertion `isActuallyCanonicalOrNull() && "Forming a CanType out of a non-canonical type!"' failed.
8  swift           0x00000000011536e2 swift::TypeBase::getCanonicalType() + 2370
14 swift           0x000000000109a2de swift::Stmt::walk(swift::ASTWalker&) + 78
15 swift           0x0000000000f03b35 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) + 549
19 swift           0x000000000109a2de swift::Stmt::walk(swift::ASTWalker&) + 78
20 swift           0x0000000000f03b35 swift::TypeChecker::computeCaptures(swift::AnyFunctionRef) + 549
22 swift           0x0000000000efb4a1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
23 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
26 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28402-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28402-swift-typebase-getcanonicaltype-e8cf35.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-24 11:32:11 +02:00
practicalswift
424602a2cb [swiftc (54 vs. 5156)] Add crasher in ?
Add test case for crash triggered in `?`.

Current number of unresolved compiler crashers: 54 (5156 resolved)

Stack trace:

```
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-24 09:19:33 +02:00
swift-ci
05e0cb65fe Merge pull request #4471 from rudkx/remove-assert 2016-08-23 23:35:05 -07:00
Mark Lacey
dc7d433a40 Remove an overzealous assert.
When we are able to type check an expression this assert is fine,
although of little value. In the context of failed type checks, though,
it can be actively harmful.

The issue is that we can attempt to solve smaller parts of the
constraint system and assign contextual types (e.g. for the arguments of
a function) despite not being able to drill into members.

Some of the diagnostics we emit in these cases are not terribly useful,
and I've opened rdar://problem/27982012 with one example.

Resolves:
  rdar://problem/25812474
  rdar://problem/26589865
  rdar://problem/27974638
2016-08-23 21:58:29 -07:00
Slava Pestov
1705caaf72 Merge pull request #4038 from karwa/generic-enums
Fix SR-2134: emit 'rawValue' bodies for enums with a generic raw value
2016-08-23 21:52:50 -07:00
practicalswift
10c4204ef0 [swiftc (53 vs. 5156)] Add crasher in swift::constraints::ConstraintSystem::assignFixedType(...)
Add test case for crash triggered in `swift::constraints::ConstraintSystem::assignFixedType(...)`.

Current number of unresolved compiler crashers: 53 (5156 resolved)

Assertion failure in [`lib/Sema/ConstraintGraph.cpp (line 207)`](https://github.com/apple/swift/blob/master/lib/Sema/ConstraintGraph.cpp#L207):

```
Assertion `!adjacency.FixedBinding && "Already marked as a fixed binding?"' failed.

When executing: void swift::constraints::ConstraintGraphNode::addFixedBinding(swift::TypeVariableType *)
```

Assertion context:

```
}

void ConstraintGraphNode::addFixedBinding(TypeVariableType *typeVar) {
  auto &adjacency = getAdjacency(typeVar);

  assert(!adjacency.FixedBinding && "Already marked as a fixed binding?");
  adjacency.FixedBinding = true;
}

void ConstraintGraphNode::removeFixedBinding(TypeVariableType *typeVar) {
  modifyAdjacency(typeVar, [](Adjacency &adj) {
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/ConstraintGraph.cpp:207: void swift::constraints::ConstraintGraphNode::addFixedBinding(swift::TypeVariableType *): Assertion `!adjacency.FixedBinding && "Already marked as a fixed binding?"' failed.
9  swift           0x0000000000f61c3e swift::constraints::ConstraintSystem::assignFixedType(swift::TypeVariableType*, swift::Type, bool) + 366
10 swift           0x0000000000fc8f9e swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 3262
11 swift           0x0000000000fcd27d swift::constraints::ConstraintSystem::matchDeepEqualityTypes(swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder) + 877
12 swift           0x0000000000fcdc15 swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 1077
13 swift           0x0000000000fd5097 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 439
14 swift           0x0000000000fddc0d swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11277
15 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
16 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
17 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
18 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
19 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
20 swift           0x0000000000fdf3c1 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 17345
21 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
22 swift           0x0000000000fdf3c1 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 17345
23 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
24 swift           0x0000000000fdf3c1 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 17345
25 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
26 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
27 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
28 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
29 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
30 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
31 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
32 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
33 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
34 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
35 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
36 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
37 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
38 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
39 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
40 swift           0x0000000000fddce4 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11492
41 swift           0x0000000000fd99c3 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
42 swift           0x0000000000fd9779 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 73
43 swift           0x0000000000ebd438 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>) + 808
44 swift           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
45 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
46 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
49 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
51 swift           0x0000000000f40ae6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
52 swift           0x0000000000efb40d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
53 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
55 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
56 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28400-swift-nominaltypedecl-prepareextensions-72c649.o
1.	While type-checking declaration 0x6578c80 at validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift:15:1
2.	While type-checking expression at [validation-test/compiler_crashers/28400-swift-nominaltypedecl-prepareextensions.swift:15:9 - line:15:28] RangeText="s1 ?? s2 ?? s3 ?? []"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-23 09:29:13 +02:00
SpringsUp
f9af1257ef Tighter type-checking of enums with synthesized RawRepresentable
conformance
Fixes SR-2134
2016-08-22 22:49:48 +02:00
practicalswift
7059140029 [swiftc (52 vs. 5156)] Add crasher in swift::irgen::emitPolymorphicParameters(...)
Add test case for crash triggered in `swift::irgen::emitPolymorphicParameters(...)`.

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

Assertion failure in [`lib/IRGen/GenProto.cpp (line 1810)`](https://github.com/apple/swift/blob/master/lib/IRGen/GenProto.cpp#L1810):

```
Assertion `targetDepType->isTypeParameter()' failed.

When executing: void addPotentialArchetypeAccessPath(swift::irgen::IRGenFunction &, swift::CanType, swift::CanType, GetTypeParameterInContextFn)
```

Assertion context:

```
  case SILFunctionTypeRepresentation::Thick:
  case SILFunctionTypeRepresentation::Thin:
  case SILFunctionTypeRepresentation::Method:
    return ty->isPolymorphic();

  case SILFunctionTypeRepresentation::CFunctionPointer:
  case SILFunctionTypeRepresentation::ObjCMethod:
    // May be polymorphic at the SIL level, but no type metadata is actually
    // passed.
    return false;

```
Stack trace:

```
swift: /path/to/swift/lib/IRGen/GenProto.cpp:1810: void addPotentialArchetypeAccessPath(swift::irgen::IRGenFunction &, swift::CanType, swift::CanType, GetTypeParameterInContextFn): Assertion `targetDepType->isTypeParameter()' failed.
10 swift           0x000000000087bd49 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 1033
12 swift           0x00000000008b35d4 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1268
13 swift           0x0000000000810c95 swift::irgen::IRGenerator::emitGlobalTopLevel() + 405
15 swift           0x00000000007ea0a4 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 68
17 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
18 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28399-getpointerelementtype-is-not-storagetype-cd8726.o
1.	While emitting IR SIL function @_TTWV4main1HS_1ES_FS1_1guRd__S_1Awx1Fzwd__1BrfGVS_1Cqd___T_ for 'g' at validation-test/compiler_crashers/28399-getpointerelementtype-is-not-storagetype.swift:19:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-22 12:27:14 +02:00
practicalswift
2548cbb78f [swiftc (51 vs. 5156)] Add crasher in swift::ArchetypeBuilder::getGenericSignature(...)
Add test case for crash triggered in `swift::ArchetypeBuilder::getGenericSignature(...)`.

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

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 2249)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L2249):

```
Assertion `pa && "Missing potential archetype for generic parameter"' failed.

When executing: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &)
```

Assertion context:

```
  // of the requirements.
  llvm::SmallPtrSet<PotentialArchetype *, 16> knownPAs;
  llvm::SmallVector<GenericTypeParamType *, 8> primary;
  for (auto param : params) {
    auto pa = builder.resolveArchetype(param);
    assert(pa && "Missing potential archetype for generic parameter");

    // We only care about the representative.
    pa = pa->getRepresentative();

    if (knownPAs.insert(pa).second)
```
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2249: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &): Assertion `pa && "Missing potential archetype for generic parameter"' failed.
8  swift           0x000000000101fae4 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1604
9  swift           0x0000000000f11128 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 296
12 swift           0x0000000000ed12b1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 945
15 swift           0x000000000113a4e2 swift::namelookup::lookupInModule(swift::ModuleDecl*, llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::DeclName, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::pair<llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >) + 1122
16 swift           0x0000000001141b3f swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 4703
17 swift           0x0000000000f1516b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
18 swift           0x0000000000ebba04 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 116
21 swift           0x000000000109a25b swift::Expr::walk(swift::ASTWalker&) + 75
22 swift           0x0000000000ebd1f0 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>) + 224
23 swift           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
24 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
25 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
32 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000efb3a2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
34 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
37 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28398-swift-archetypebuilder-getgenericsignature-207c59.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift:10:26 - line:10:27] RangeText="c<"
3.	While type-checking '<' at validation-test/compiler_crashers/28398-swift-archetypebuilder-getgenericsignature.swift:10:50
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-19 09:12:15 +02:00
practicalswift
dfb357c6c4 [swiftc (50 vs. 5156)] Add crasher in ?
Add test case for crash triggered in `?`.

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

Stack trace:

```
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-18 09:38:30 +02:00
practicalswift
ccf44d8f98 [swiftc (49 vs. 5156)] Add crasher in swift::SILModule::constructSIL(...)
Add test case for crash triggered in `swift::SILModule::constructSIL(...)`.

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

Assertion failure in [`lib/SILGen/SILGenApply.cpp (line 1114)`](https://github.com/apple/swift/blob/master/lib/SILGen/SILGenApply.cpp#L1114):

```
Assertion `vd->isLet() && "Direct reference to vardecl that isn't a let?"' failed.

When executing: void (anonymous namespace)::SILGenApply::visitDeclRefExpr(swift::DeclRefExpr *)
```

Assertion context:

```

    // If this is a direct reference to a vardecl, it must be a let constant
    // (which doesn't need to be loaded).  Just emit its value directly.
    if (auto *vd = dyn_cast<VarDecl>(e->getDecl())) {
      (void)vd;
      assert(vd->isLet() && "Direct reference to vardecl that isn't a let?");
      visitExpr(e);
      return;
    }

    SILDeclRef constant(e->getDecl(),
```
Stack trace:

```
swift: /path/to/swift/lib/SILGen/SILGenApply.cpp:1114: void (anonymous namespace)::SILGenApply::visitDeclRefExpr(swift::DeclRefExpr *): Assertion `vd->isLet() && "Direct reference to vardecl that isn't a let?"' failed.
37 swift           0x000000000093f4c2 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 498
38 swift           0x000000000093fa36 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
40 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
41 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28396-swift-lowering-silgenfunction-emitclosurevalue-c63b87.o
1.	While emitting SIL for 'a' at validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift:10:1
2.	While emitting SIL for getter for b at validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift:10:22
3.	While silgen closureexpr SIL function @_TFFF4main1aFT_T_gL_1bFT_T_U_FT_T_ for expression at [validation-test/compiler_crashers/28396-swift-lowering-silgenfunction-emitclosurevalue.swift:10:29 - line:10:33] RangeText="{b()}"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-16 12:00:49 +02:00
practicalswift
40db42f36f [swiftc (48 vs. 5156)] Add crasher in swift::Expr::propagateLValueAccessKind(...)
Add test case for crash triggered in `swift::Expr::propagateLValueAccessKind(...)`.

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

Stack trace:

```
6  swift           0x00000000032eaf5d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
8  swift           0x0000000001113fc7 swift::Expr::propagateLValueAccessKind(swift::AccessKind, bool) + 23
12 swift           0x000000000109a27c swift::Expr::walk(swift::ASTWalker&) + 108
13 swift           0x0000000000f6d412 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
14 swift           0x0000000000ec44da swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
17 swift           0x0000000000f8c17d swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 7021
18 swift           0x0000000000f90a3e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
19 swift           0x0000000000ebd469 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>) + 857
20 swift           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
21 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
22 swift           0x0000000000ec6335 swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 373
26 swift           0x0000000000f409a4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
27 swift           0x0000000000f6d57c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
28 swift           0x0000000000ec44da swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
30 swift           0x0000000000f40ae6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
31 swift           0x0000000000efb40d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
32 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
34 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
35 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28395-swift-expr-propagatelvalueaccesskind-943db0.o
1.	While type-checking expression at [validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift:9:1 - line:9:24] RangeText="{guard let b=.h.h=.n?(){"
2.	While type-checking expression at [validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift:9:14 - line:9:23] RangeText=".h.h=.n?()"
3.	While type-checking expression at [validation-test/compiler_crashers/28395-swift-expr-propagatelvalueaccesskind.swift:9:14 - line:9:23] RangeText=".h.h=.n?()"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-12 10:59:50 +02:00
practicalswift
8b5f8d1aed [swiftc (47 vs. 5156)] Add crasher in swift::TypeChecker::checkConformance(...)
Add test case for crash triggered in `swift::TypeChecker::checkConformance(...)`.

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

Assertion failure in [`lib/Sema/TypeCheckProtocol.cpp (line 1598)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckProtocol.cpp#L1598):

```
Assertion `isa<SubscriptDecl>(VD) && "Unhandled requirement kind"' failed.

When executing: diag::RequirementKind getRequirementKind(swift::ValueDecl *)
```

Assertion context:

```
  if (isa<ConstructorDecl>(VD))
    return diag::RequirementKind::Constructor;

  if (isa<FuncDecl>(VD))
    return diag::RequirementKind::Func;

  if (isa<VarDecl>(VD))
    return diag::RequirementKind::Var;

  assert(isa<SubscriptDecl>(VD) && "Unhandled requirement kind");
  return diag::RequirementKind::Subscript;
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckProtocol.cpp:1598: diag::RequirementKind getRequirementKind(swift::ValueDecl *): Assertion `isa<SubscriptDecl>(VD) && "Unhandled requirement kind"' failed.
11 swift           0x0000000000f1f666 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 1686
12 swift           0x0000000000f1fda7 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 471
15 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift           0x0000000000efb42a swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1162
17 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
19 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
20 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28394-swift-typechecker-checkconformance.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28394-swift-typechecker-checkconformance-09c483.o
1.	While type-checking 'd' at validation-test/compiler_crashers/28394-swift-typechecker-checkconformance.swift:10:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-11 13:22:20 +02:00
practicalswift
53ef34c8a9 [swiftc (46 vs. 5156)] Add crasher in swift::Type::transform(...)
Add test case for crash triggered in `swift::Type::transform(...)`.

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

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

```
Assertion `Val && "isa<> used on a null pointer"' failed.

When executing: static bool llvm::isa_impl_cl<swift::SILFunctionType, const swift::TypeBase *>::doit(const From *) [To = swift::SILFunctionType, From = const swift::TypeBase *]
```

Assertion context:

```
  }
};

template <typename To, typename From> struct isa_impl_cl<To, const From*> {
  static inline bool doit(const From *Val) {
    assert(Val && "isa<> used on a null pointer");
    return isa_impl<To, From>::doit(*Val);
  }
};

template <typename To, typename From> struct isa_impl_cl<To, const From*const> {
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<swift::SILFunctionType, const swift::TypeBase *>::doit(const From *) [To = swift::SILFunctionType, From = const swift::TypeBase *]: Assertion `Val && "isa<> used on a null pointer"' failed.
9  swift           0x000000000115ba63 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 35
10 swift           0x0000000001154db4 swift::Type::subst(swift::ModuleDecl*, llvm::DenseMap<swift::TypeBase*, swift::Type, llvm::DenseMapInfo<swift::TypeBase*>, llvm::detail::DenseMapPair<swift::TypeBase*, swift::Type> >&, swift::OptionSet<swift::SubstFlags, unsigned int>) const + 68
13 swift           0x0000000000f21cce swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 254
14 swift           0x000000000114c436 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150
15 swift           0x000000000114c378 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
17 swift           0x0000000000f15254 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 420
18 swift           0x0000000000ebba04 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 116
20 swift           0x000000000109a22b swift::Expr::walk(swift::ASTWalker&) + 27
21 swift           0x0000000000ebd1f0 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>) + 224
22 swift           0x0000000000ec443d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
23 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
24 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
29 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
30 swift           0x0000000000efb3a2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
31 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
34 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28393-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28393-swift-type-transform-10c33b.o
1.	While type-checking 'S' at validation-test/compiler_crashers/28393-swift-type-transform.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28393-swift-type-transform.swift:10:16 - line:10:16] RangeText="b"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-10 12:51:56 +02:00
practicalswift
ed461ceb09 [swiftc (45 vs. 5156)] Add crasher in swift::DependentGenericTypeResolver::resolveSelfAssociatedType(...)
Add test case for crash triggered in `swift::DependentGenericTypeResolver::resolveSelfAssociatedType(...)`.

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

Assertion failure in [`lib/Sema/TypeCheckGeneric.cpp (line 47)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckGeneric.cpp#L47):

```
Assertion `archetype && "Bad generic context nesting?"' failed.

When executing: virtual swift::Type swift::DependentGenericTypeResolver::resolveSelfAssociatedType(swift::Type, swift::DeclContext *, swift::AssociatedTypeDecl *)
```

Assertion context:

```
Type DependentGenericTypeResolver::resolveSelfAssociatedType(
       Type selfTy,
       DeclContext *DC,
       AssociatedTypeDecl *assocType) {
  auto archetype = Builder.resolveArchetype(selfTy);
  assert(archetype && "Bad generic context nesting?");

  return archetype->getRepresentative()
           ->getNestedType(assocType->getName(), Builder)
           ->getDependentType(Builder, true);
}
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckGeneric.cpp:47: virtual swift::Type swift::DependentGenericTypeResolver::resolveSelfAssociatedType(swift::Type, swift::DeclContext *, swift::AssociatedTypeDecl *): Assertion `archetype && "Bad generic context nesting?"' failed.
8  swift           0x0000000000f102ad swift::DependentGenericTypeResolver::resolveSelfAssociatedType(swift::Type, swift::DeclContext*, swift::AssociatedTypeDecl*) + 125
9  swift           0x0000000000f457c4 swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 1956
13 swift           0x0000000000f46a7e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
15 swift           0x0000000000f479c4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
16 swift           0x0000000000f46970 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
18 swift           0x0000000000f1105e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
21 swift           0x0000000000ed12b1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 945
25 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
28 swift           0x0000000000f409a4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
29 swift           0x0000000000f6d57c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
30 swift           0x0000000000ec44da swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
31 swift           0x0000000000ec55f0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
32 swift           0x0000000000ec580b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
43 swift           0x0000000000ed7466 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
46 swift           0x0000000000f409a4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
47 swift           0x0000000000f6d57c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
48 swift           0x0000000000ec44da swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
50 swift           0x0000000000f40ae6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
51 swift           0x0000000000efb40d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
52 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
54 swift           0x00000000007db487 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
55 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype-0402cf.o
1.	While type-checking expression at [validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift:10:1 - line:21:1] RangeText="{
2.	While type-checking 'A' at validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift:11:1
3.	While type-checking expression at [validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift:17:7 - line:21:1] RangeText="{
4.	While type-checking 'h' at validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift:18:1
5.	While type-checking 'a' at validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift:20:1
6.	While resolving type e at [validation-test/compiler_crashers/28392-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift:20:8 - line:20:8] RangeText="e"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-09 09:10:39 +02:00
practicalswift
44f2a749f9 [swiftc (44 vs. 5156)] Add crasher in swift::TypeChecker::validateDecl(...)
Add test case for crash triggered in `swift::TypeChecker::validateDecl(...)`.

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

Assertion failure in [`lib/Sema/TypeCheckDecl.cpp (line 4724)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckDecl.cpp#L4724):

```
Assertion `!FD->getType()->hasTypeParameter()' failed.

When executing: void (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl *)
```

Assertion context:

```

    if (FD->isInvalid())
      return;

    // This type check should have created a non-dependent type.
    assert(!FD->getType()->hasTypeParameter());

    validateAttributes(TC, FD);

    // Member functions need some special validation logic.
    if (FD->getDeclContext()->isTypeContext()) {
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:4724: void (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl *): Assertion `!FD->getType()->hasTypeParameter()' failed.
10 swift           0x0000000000ed1301 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 945
12 swift           0x0000000000ed1c92 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
13 swift           0x0000000001142d7b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
14 swift           0x00000000011416e0 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2864
15 swift           0x0000000000f151bb swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
18 swift           0x0000000000f46a9e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
20 swift           0x0000000000f479e4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
21 swift           0x0000000000f46990 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
23 swift           0x0000000000f18305 swift::TypeChecker::typeCheckParameterList(swift::ParameterList*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 117
25 swift           0x0000000000f110ae swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
32 swift           0x0000000000ed74b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000efb3f2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
34 swift           0x0000000000c7b5c9 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007db4f7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
37 swift           0x00000000007a7328 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28391-swift-typechecker-validatedecl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28391-swift-typechecker-validatedecl-1d567d.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28391-swift-typechecker-validatedecl.swift:10:1
2.	While resolving type f at [validation-test/compiler_crashers/28391-swift-typechecker-validatedecl.swift:10:39 - line:10:39] RangeText="f"
3.	While type-checking 'f' at validation-test/compiler_crashers/28391-swift-typechecker-validatedecl.swift:10:41
4.	While type-checking 'f' at validation-test/compiler_crashers/28391-swift-typechecker-validatedecl.swift:10:32
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-08 22:16:14 +02:00
practicalswift
c5572f6e44 [swiftc (43 vs. 5156)] Add crasher in swift::Expr::walk(...)
Add test case for crash triggered in `swift::Expr::walk(...)`.

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

Assertion failure in [`include/swift/AST/Stmt.h (line 170)`](https://github.com/apple/swift/blob/master/include/swift/AST/Stmt.h#L170):

```
Assertion `Result && "ReturnStmt doesn't have a result"' failed.

When executing: swift::Expr *swift::ReturnStmt::getResult() const
```

Assertion context:

```
  SourceLoc getStartLoc() const;
  SourceLoc getEndLoc() const;

  bool hasResult() const { return Result != 0; }
  Expr *getResult() const {
    assert(Result && "ReturnStmt doesn't have a result");
    return Result;
  }
  void setResult(Expr *e) { Result = e; }

  static bool classof(const Stmt *S) { return S->getKind() == StmtKind::Return;}
```
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Stmt.h:170: swift::Expr *swift::ReturnStmt::getResult() const: Assertion `Result && "ReturnStmt doesn't have a result"' failed.
12 swift           0x000000000109a52b swift::Expr::walk(swift::ASTWalker&) + 75
13 swift           0x0000000001114d38 swift::Expr::forEachChildExpr(std::function<swift::Expr* (swift::Expr*)> const&) + 40
15 swift           0x0000000000f8c19d swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 7021
16 swift           0x0000000000f90a5e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
17 swift           0x0000000000ebd4b9 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>) + 857
18 swift           0x0000000000ec448d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
21 swift           0x0000000000f8c19d swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 7021
22 swift           0x0000000000f90a5e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
23 swift           0x0000000000ebd4b9 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>) + 857
24 swift           0x0000000000ec448d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
26 swift           0x0000000000f40b06 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
27 swift           0x0000000000efb45d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
28 swift           0x0000000000c7b5c9 swift::CompilerInstance::performSema() + 3289
30 swift           0x00000000007db4f7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
31 swift           0x00000000007a7328 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28390-swift-expr-walk.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28390-swift-expr-walk-405a1f.o
1.	While type-checking expression at [validation-test/compiler_crashers/28390-swift-expr-walk.swift:10:1 - line:11:7] RangeText=".h={return
2.	While type-checking expression at [validation-test/compiler_crashers/28390-swift-expr-walk.swift:10:1 - line:11:7] RangeText=".h={return
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-08 14:00:15 +02:00
practicalswift
27352a3a1f [swiftc (42 vs. 5156)] Add crasher in swift::lookupVisibleDecls(...)
Add test case for crash triggered in `swift::lookupVisibleDecls(...)`.

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

Assertion failure in [`lib/AST/LookupVisibleDecls.cpp (line 566)`](https://github.com/apple/swift/blob/master/lib/AST/LookupVisibleDecls.cpp#L566):

```
Assertion `BaseTy.getPointer() != CurClass->getSuperclass().getPointer() && "type is its own superclass"' failed.

When executing: void lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer &, const swift::DeclContext *, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver *, VisitedSet &)
```

Assertion context:

```
    // If we have a class type, look into its superclass.
    ClassDecl *CurClass = dyn_cast<ClassDecl>(CurNominal);

    if (CurClass && CurClass->hasSuperclass()) {
      assert(BaseTy.getPointer() != CurClass->getSuperclass().getPointer() &&
             "type is its own superclass");
      BaseTy = CurClass->getSuperclass();
      Reason = getReasonForSuper(Reason);

      bool InheritsSuperclassInitializers =
          CurClass->inheritsSuperclassInitializers(TypeResolver);
```
Stack trace:

```
swift: /path/to/swift/lib/AST/LookupVisibleDecls.cpp:566: void lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer &, const swift::DeclContext *, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver *, VisitedSet &): Assertion `BaseTy.getPointer() != CurClass->getSuperclass().getPointer() && "type is its own superclass"' failed.
10 swift           0x0000000001121734 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1188
11 swift           0x0000000000f16672 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
12 swift           0x0000000000ebc9ba swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4058
14 swift           0x000000000109a4fb swift::Expr::walk(swift::ASTWalker&) + 27
15 swift           0x0000000000ebd240 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>) + 224
16 swift           0x0000000000ec448d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
17 swift           0x0000000000ec5640 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
18 swift           0x0000000000ec585b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
20 swift           0x0000000000ed1e5b swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3851
25 swift           0x0000000000f1665b swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 267
27 swift           0x0000000000f8af6c swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 2364
28 swift           0x0000000000f90a5e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
29 swift           0x0000000000ebd4b9 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>) + 857
30 swift           0x0000000000ec448d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
31 swift           0x0000000000ec5640 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
32 swift           0x0000000000ec585b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
37 swift           0x0000000000ed74b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
38 swift           0x0000000000efb3f2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
39 swift           0x0000000000c7b5c9 swift::CompilerInstance::performSema() + 3289
41 swift           0x00000000007db4f7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
42 swift           0x00000000007a7328 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28389-swift-lookupvisibledecls.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28389-swift-lookupvisibledecls-e9a1a8.o
1.	While type-checking 'B' at validation-test/compiler_crashers/28389-swift-lookupvisibledecls.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28389-swift-lookupvisibledecls.swift:10:16 - line:10:18] RangeText="A.b"
3.	While type-checking expression at [validation-test/compiler_crashers/28389-swift-lookupvisibledecls.swift:10:36 - line:10:36] RangeText="V"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-08 09:47:53 +02:00
practicalswift
67fb4d9d43 [swiftc (41 vs. 5156)] Add crasher in swift::TypeBase::getCanonicalType(...)
Add test case for crash triggered in `swift::TypeBase::getCanonicalType(...)`.

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

Stack trace:

```
4  swift           0x0000000001152aa4 swift::TypeBase::getCanonicalType() + 20
5  swift           0x00000000011314bf swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 1215
6  swift           0x0000000000f1e3ca swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 106
9  swift           0x0000000000f219be swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 254
10 swift           0x000000000114c126 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150
11 swift           0x000000000114c068 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
13 swift           0x0000000000f14f64 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 404
14 swift           0x0000000000ebb724 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 116
17 swift           0x0000000001099f4b swift::Expr::walk(swift::ASTWalker&) + 75
18 swift           0x0000000000ebcf10 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>) + 224
19 swift           0x0000000000ec415d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
20 swift           0x0000000000ec5310 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
21 swift           0x0000000000ec552b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
30 swift           0x0000000000ed7186 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
31 swift           0x0000000000efb0c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
32 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
34 swift           0x00000000007db4e7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
35 swift           0x00000000007a72d8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28388-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28388-swift-typebase-getcanonicaltype-da6437.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28388-swift-typebase-getcanonicaltype.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28388-swift-typebase-getcanonicaltype.swift:9:55 - line:9:57] RangeText="f=1"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-07 21:37:49 +02:00
practicalswift
d0de6210e9 [swiftc (40 vs. 5156)] Add crasher in swift::TypeBase::gatherAllSubstitutions(...)
Add test case for crash triggered in `swift::TypeBase::gatherAllSubstitutions(...)`.

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

Stack trace:

```
6  swift           0x00000000032eac4d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
7  swift           0x0000000001130f7e swift::TypeBase::gatherAllSubstitutions(swift::ModuleDecl*, swift::LazyResolver*, swift::DeclContext*) + 4398
8  swift           0x0000000001131647 swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 1607
9  swift           0x0000000000f1e3ca swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 106
12 swift           0x0000000000f219be swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 254
13 swift           0x000000000114c126 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150
14 swift           0x000000000114c068 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
15 swift           0x000000000114c356 swift::SpecializedProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 230
16 swift           0x000000000114c052 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 18
17 swift           0x000000000114c836 swift::ProtocolConformance::getTypeWitness(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 6
18 swift           0x0000000000f45655 swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 2373
22 swift           0x0000000000f4676e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
24 swift           0x0000000000f476b4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
25 swift           0x0000000000f46660 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
27 swift           0x0000000000f10d7e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
30 swift           0x0000000000ed0fd1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 945
36 swift           0x0000000000ed7186 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
37 swift           0x0000000000efb0c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
38 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
40 swift           0x00000000007db4e7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
41 swift           0x00000000007a72d8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28387-swift-typebase-gatherallsubstitutions.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28387-swift-typebase-gatherallsubstitutions-896572.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28387-swift-typebase-gatherallsubstitutions.swift:9:1
2.	While type-checking 'c' at validation-test/compiler_crashers/28387-swift-typebase-gatherallsubstitutions.swift:13:1
3.	While resolving type d at [validation-test/compiler_crashers/28387-swift-typebase-gatherallsubstitutions.swift:13:8 - line:13:8] RangeText="d"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-07 20:27:59 +02:00
practicalswift
3cfb2c9d32 [swiftc (39 vs. 5156)] Add crasher in swift::TypeBase::getDesugaredType(...)
Add test case for crash triggered in `swift::TypeBase::getDesugaredType(...)`.

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

Stack trace:

```
4  swift           0x0000000001157360 swift::TypeBase::getDesugaredType() + 32
6  swift           0x0000000000edc01e swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 654
7  swift           0x0000000000ecfa1e swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5998
8  swift           0x0000000000ed0d97 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 375
12 swift           0x0000000000f4676e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
14 swift           0x0000000000f476b4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000f46660 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
16 swift           0x0000000000ecf74a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5274
17 swift           0x0000000000ed0d97 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 375
21 swift           0x0000000000f4676e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
23 swift           0x0000000000f476b4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
24 swift           0x0000000000f46660 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
25 swift           0x0000000000f18f01 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 945
28 swift           0x0000000000ed7186 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
31 swift           0x0000000000f3f7bd swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 845
32 swift           0x0000000000f3f1c2 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 34
33 swift           0x0000000000f3fd93 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
35 swift           0x0000000000efb1c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
36 swift           0x0000000000c7b5b9 swift::CompilerInstance::performSema() + 3289
38 swift           0x00000000007db4e7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
39 swift           0x00000000007a72d8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28386-swift-typebase-getdesugaredtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28386-swift-typebase-getdesugaredtype-c6011a.o
1.	While type-checking 'init' at validation-test/compiler_crashers/28386-swift-typebase-getdesugaredtype.swift:9:10
2.	While type-checking declaration 0x6733b58 at validation-test/compiler_crashers/28386-swift-typebase-getdesugaredtype.swift:9:17
3.	While resolving type A at [validation-test/compiler_crashers/28386-swift-typebase-getdesugaredtype.swift:9:21 - line:9:21] RangeText="A"
4.	While resolving type B at [validation-test/compiler_crashers/28386-swift-typebase-getdesugaredtype.swift:11:9 - line:11:9] RangeText="B"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-07 19:23:05 +02:00
practicalswift
c9cdc8b0e8 [swiftc (38 vs. 5156)] Add crasher in swift::constraints::ConstraintGraph::addConstraint(...)
Add test case for crash triggered in `swift::constraints::ConstraintGraph::addConstraint(...)`.

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

Assertion failure in [`lib/Sema/ConstraintGraph.cpp (line 50)`](https://github.com/apple/swift/blob/master/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:

```
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:

```
swift: /path/to/swift/lib/Sema/ConstraintGraph.cpp:50: std::pair<ConstraintGraphNode &, unsigned int> swift::constraints::ConstraintGraph::lookupNode(swift::TypeVariableType *): Assertion `impl.getGraphIndex() < TypeVariables.size() && "Out-of-bounds index"' failed.
9  swift           0x000000000100b20f swift::constraints::ConstraintGraph::addConstraint(swift::constraints::Constraint*) + 127
10 swift           0x0000000000f62b62 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 258
11 swift           0x0000000000fc8085 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 1685
12 swift           0x0000000000fcc186 swift::constraints::ConstraintSystem::matchTupleToScalarTypes(swift::TupleType*, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 182
13 swift           0x0000000000fcd2c2 swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 978
14 swift           0x0000000000fca954 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 12132
15 swift           0x0000000000fd4866 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 630
16 swift           0x0000000000f62a77 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
17 swift           0x0000000000ec690a swift::TypeChecker::typesSatisfyConstraint(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::DeclContext*) + 138
18 swift           0x0000000000ec6a5f swift::TypeChecker::typeCheckCheckedCast(swift::Type, swift::Type, swift::DeclContext*, swift::SourceLoc, swift::SourceRange, swift::SourceRange, std::function<bool (swift::Type)>, bool) + 79
20 swift           0x0000000000f8a352 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 114
21 swift           0x0000000000f9070e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
22 swift           0x0000000000ebd169 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>) + 857
23 swift           0x0000000000ec413d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
26 swift           0x0000000000f8a340 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 96
27 swift           0x0000000000f9070e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
28 swift           0x0000000000ebd169 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>) + 857
29 swift           0x0000000000ec413d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
33 swift           0x0000000000f8a340 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 96
34 swift           0x0000000000f9070e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
35 swift           0x0000000000ebd169 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>) + 857
36 swift           0x0000000000ec413d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
38 swift           0x0000000000f407b6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
39 swift           0x0000000000efb10d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
40 swift           0x0000000000c7b599 swift::CompilerInstance::performSema() + 3289
42 swift           0x00000000007db4c7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
43 swift           0x00000000007a72b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28385-swift-constraints-constraintgraph-addconstraint.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28385-swift-constraints-constraintgraph-addconstraint-8d8da3.o
1.	While type-checking expression at [validation-test/compiler_crashers/28385-swift-constraints-constraintgraph-addconstraint.swift:10:1 - line:10:17] RangeText="assert((n:String{"
2.	While type-checking expression at [validation-test/compiler_crashers/28385-swift-constraints-constraintgraph-addconstraint.swift:10:7 - line:10:17] RangeText="((n:String{"
3.	While type-checking expression at [validation-test/compiler_crashers/28385-swift-constraints-constraintgraph-addconstraint.swift:10:8 - line:10:17] RangeText="(n:String{"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-06 12:27:06 +02:00
Slava Pestov
22aa032285 Sema: Clean up SE-0036 diagnostic a bit
Suggest a fix-it for unqualified references to all static members
from instance context, not just enum elements.

Also, fix a small problem with the fix-it for replacing protocol
names with 'Self' inside extension bodies -- we didn't handle nested
functions properly.
2016-08-05 14:27:16 -07:00
practicalswift
3ad815aeb2 [swiftc (38 vs. 5155)] Add crasher in swift::constraints::ConstraintGraphNode::getMemberType(...)
Add test case for crash triggered in `swift::constraints::ConstraintGraphNode::getMemberType(...)`.

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

Stack trace:

```
6  swift           0x00000000010073e6 swift::constraints::ConstraintGraphNode::getMemberType(swift::Identifier, std::function<swift::TypeVariableType* ()>) + 182
7  swift           0x0000000001007fca swift::constraints::ConstraintGraph::getMemberType(swift::TypeVariableType*, swift::Identifier, std::function<swift::TypeVariableType* ()>) + 154
9  swift           0x0000000001157493 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 35
10 swift           0x0000000000f62f4b swift::constraints::ConstraintSystem::openGeneric(swift::DeclContext*, swift::DeclContext*, llvm::ArrayRef<swift::GenericTypeParamType*>, llvm::ArrayRef<swift::Requirement>, bool, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 1659
11 swift           0x0000000000f210a4 swift::TypeChecker::isProtocolExtensionUsable(swift::DeclContext*, swift::Type, swift::ExtensionDecl*) + 356
17 swift           0x000000000111ce14 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1188
18 swift           0x0000000000f14bf2 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
19 swift           0x0000000000ebb32a swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4058
21 swift           0x0000000001095c3b swift::Expr::walk(swift::ASTWalker&) + 27
22 swift           0x0000000000ebbbb0 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>) + 224
23 swift           0x0000000000ec2a3d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
24 swift           0x0000000000ec3bf0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
25 swift           0x0000000000ec3e0b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
32 swift           0x0000000000ed5a26 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000ef9972 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
34 swift           0x0000000000c7aa69 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007db2c7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
37 swift           0x00000000007a7148 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28383-swift-constraints-constraintgraphnode-getmembertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28383-swift-constraints-constraintgraphnode-getmembertype-b45c8b.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28383-swift-constraints-constraintgraphnode-getmembertype.swift:13:1
2.	While type-checking expression at [validation-test/compiler_crashers/28383-swift-constraints-constraintgraphnode-getmembertype.swift:14:16 - line:14:16] RangeText="g"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-04 10:22:50 +02:00
practicalswift
4154d6b317 Merge pull request #3934 from practicalswift/swiftc-28382-swift-archetypebuilder-maptypeoutofcontext
[swiftc (38 vs. 5154)] Add crasher in swift::ArchetypeBuilder::mapTypeOutOfContext(...)
2016-08-04 10:21:57 +02:00
Slava Pestov
75bd88968b SILGen: Allow extensions to define designated initializers of generic types
Previously, if a generic type had a stored property with
a generic type and an initializer expression, we would
emit the expression directly in the body of each designated
initializer.

This is a problem if the designated initializer is defined
within an extension (even in the same source file), because
extensions have a different set of generic parameters and
archetypes.

Also, we've had bugs in the past where emitting an
expression multiple times didn't work properly. While these
might currently all be fixed, this is a tricky case to test
and it would be best to avoid it.

Fix both problems by emitting the initializer expression
inside its own function at the SIL level, and call the
initializer function from each designated initializer.

I'm using the existing 'variable initializer' mangling for this;
it doesn't seem to be used for anything else right now.

Currently, the default memberwise initializer does not use
this, because the machinery for emitting it is somewhat
duplicated and separate from the initializer expressions in
user-defined constructors. I'll clean this up in an upcoming
patch.

Fixes <https://bugs.swift.org/browse/SR-488>.
2016-08-03 01:03:08 -07:00
practicalswift
496089c7b9 [swiftc (38 vs. 5154)] Add crasher in swift::ArchetypeBuilder::mapTypeOutOfContext(...)
Add test case for crash triggered in `swift::ArchetypeBuilder::mapTypeOutOfContext(...)`.

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

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 2086)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L2086):

```
Assertion `!canType->hasTypeParameter() && "already have an interface type"' failed.

When executing: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type)
```

Assertion context:

```

Type ArchetypeBuilder::mapTypeOutOfContext(ModuleDecl *M,
                                           GenericParamList *genericParams,
                                           Type type) {
  auto canType = type->getCanonicalType();
  assert(!canType->hasTypeParameter() && "already have an interface type");
  if (!canType->hasArchetype())
    return type;

  assert(genericParams && "dependent type in non-generic context");

```
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2086: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!canType->hasTypeParameter() && "already have an interface type"' failed.
8  swift           0x00000000010169b5 swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type) + 293
11 swift           0x0000000000ecc972 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
12 swift           0x000000000113982b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
13 swift           0x00000000011380b1 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2833
14 swift           0x0000000000f0fc4b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
17 swift           0x0000000000f4190e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
19 swift           0x0000000000f42864 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
20 swift           0x0000000000f41800 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
21 swift           0x000000000100c83e swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 158
22 swift           0x0000000000fe2a0d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
23 swift           0x0000000000ec9279 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
24 swift           0x0000000000ecc0cd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1181
28 swift           0x0000000000f4190e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
30 swift           0x0000000000f42864 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
31 swift           0x0000000000f41800 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
34 swift           0x0000000000ecc972 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
37 swift           0x0000000000ed2096 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
40 swift           0x0000000000f3a50a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
41 swift           0x0000000000f3a36e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
42 swift           0x0000000000f3af33 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
44 swift           0x0000000000ef5f71 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
45 swift           0x0000000000c76f49 swift::CompilerInstance::performSema() + 3289
47 swift           0x00000000007dadd7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
48 swift           0x00000000007a6ca8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28382-swift-archetypebuilder-maptypeoutofcontext-e6d0cd.o
1.	While type-checking getter for b at validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift:10:6
2.	While type-checking 'e' at validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift:12:1
3.	While type-checking 'e' at validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift:12:1
4.	While resolving type A at [validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift:12:13 - line:12:13] RangeText="A"
5.	While resolving type e at [validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift:14:13 - line:14:13] RangeText="e"
6.	While type-checking 'e' at validation-test/compiler_crashers/28382-swift-archetypebuilder-maptypeoutofcontext.swift:15:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-08-02 22:04:48 +02:00
Dmitri Gribenko
fc89bb1ac6 Merge pull request #3772 from practicalswift/swiftc-28379-swift-constraints-constraintsystem-diagnosefailureforexpr
[swiftc (35 vs. 5154)] Add crasher in swift::constraints::ConstraintSystem::diagnoseFailureForExpr(...)
2016-08-01 11:17:09 -07:00
practicalswift
bf2ef1e014 [swiftc (36 vs. 5154)] Add crasher in swift::ArchetypeBuilder::addRequirement(...)
Add test case for crash triggered in `swift::ArchetypeBuilder::addRequirement(...)`.

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

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 1489)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L1489):

```
Assertion `!invalid && "Re-introducing invalid requirement"' failed.

When executing: void swift::ArchetypeBuilder::addRequirement(const swift::Requirement &, swift::RequirementSource)
```

Assertion context:

```
    (void)existential;

    // Add each of the protocols.
    for (auto proto : conformsTo) {
      bool invalid = addConformanceRequirement(pa, proto, source);
      assert(!invalid && "Re-introducing invalid requirement");
      (void)invalid;
    }

    return;
  }
```
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1489: void swift::ArchetypeBuilder::addRequirement(const swift::Requirement &, swift::RequirementSource): Assertion `!invalid && "Re-introducing invalid requirement"' failed.
8  swift           0x00000000010168bd swift::ArchetypeBuilder::addRequirement(swift::Requirement const&, swift::RequirementSource) + 605
9  swift           0x0000000001018553 swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, bool, bool) + 515
10 swift           0x0000000000f0c52f swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 63
11 swift           0x0000000000f0df47 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
12 swift           0x0000000000f0ea9f swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 111
13 swift           0x0000000000ecd466 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1830
14 swift           0x000000000113b66b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
15 swift           0x0000000001139efb swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2491
16 swift           0x0000000000f10d5b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
19 swift           0x0000000000f4322e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
21 swift           0x0000000000f44184 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
22 swift           0x0000000000f43120 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
23 swift           0x0000000000f14df9 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 937
25 swift           0x0000000000ecdc4b swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3851
28 swift           0x0000000000f1be0e swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 1694
29 swift           0x0000000000f1c547 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 471
32 swift           0x0000000000ed31a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
35 swift           0x0000000000f3d154 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
36 swift           0x0000000000f696ac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
37 swift           0x0000000000ec037a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
40 swift           0x0000000000f3d154 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
41 swift           0x0000000000f696ac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
42 swift           0x0000000000ec037a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
44 swift           0x0000000000f3d296 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
45 swift           0x0000000000ef6fed swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
46 swift           0x0000000000c77d69 swift::CompilerInstance::performSema() + 3289
48 swift           0x00000000007db0d7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
49 swift           0x00000000007a6fb8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28381-swift-archetypebuilder-addrequirement.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28381-swift-archetypebuilder-addrequirement-cb9111.o
1.	While type-checking expression at [validation-test/compiler_crashers/28381-swift-archetypebuilder-addrequirement.swift:10:1 - line:14:13] RangeText="{{
2.	While type-checking expression at [validation-test/compiler_crashers/28381-swift-archetypebuilder-addrequirement.swift:10:2 - line:11:10] RangeText="{
3.	While type-checking 'A' at validation-test/compiler_crashers/28381-swift-archetypebuilder-addrequirement.swift:11:1
4.	While resolving type A at [validation-test/compiler_crashers/28381-swift-archetypebuilder-addrequirement.swift:12:7 - line:12:7] RangeText="A"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-31 19:54:15 +02:00
practicalswift
0bf6376a56 [swiftc (35 vs. 5154)] Add crasher in swift::Type::transform(...)
Add test case for crash triggered in `swift::Type::transform(...)`.

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

Stack trace:

```
5  swift           0x0000000001152d13 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 35
6  swift           0x000000000115399f swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 3247
7  swift           0x0000000000f5ebde swift::constraints::ConstraintSystem::openType(swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 78
10 swift           0x000000000109170c swift::Expr::walk(swift::ASTWalker&) + 108
11 swift           0x0000000000faa0c8 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
12 swift           0x0000000000eb8e93 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>) + 371
13 swift           0x0000000000ebfc8d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
14 swift           0x0000000000ec1994 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 180
15 swift           0x0000000000ec1aeb swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 251
19 swift           0x0000000000f3cb04 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
20 swift           0x0000000000f690cc swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
21 swift           0x0000000000ebfd2a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
24 swift           0x0000000000f3b7da swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
25 swift           0x0000000000f3b63e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
26 swift           0x0000000000f3c203 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
28 swift           0x0000000000ef6a31 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
29 swift           0x0000000000c77be9 swift::CompilerInstance::performSema() + 3289
31 swift           0x00000000007daf57 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
32 swift           0x00000000007a6e38 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28380-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28380-swift-type-transform-07a9ce.o
1.	While type-checking 'f' at validation-test/compiler_crashers/28380-swift-type-transform.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28380-swift-type-transform.swift:9:10 - line:9:24] RangeText="{if true as[T.h"
3.	While type-checking expression at [validation-test/compiler_crashers/28380-swift-type-transform.swift:9:14 - line:9:24] RangeText="true as[T.h"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-30 18:54:51 +02:00
practicalswift
a7d4820425 [swiftc (35 vs. 5154)] Add crasher in swift::constraints::ConstraintSystem::diagnoseFailureForExpr(...)
Add test case for crash triggered in `swift::constraints::ConstraintSystem::diagnoseFailureForExpr(...)`.

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

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

```
Assertion `Index < Length && "Invalid index!"' failed.

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

Assertion context:

```

    /// @}
    /// @name Operator Overloads
    /// @{
    const T &operator[](size_t Index) const {
      assert(Index < Length && "Invalid index!");
      return Data[Index];
    }

    /// @}
    /// @name Expensive Operations
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/ArrayRef.h:186: const T &llvm::ArrayRef<swift::Expr *>::operator[](size_t) const [T = swift::Expr *]: Assertion `Index < Length && "Invalid index!"' failed.
11 swift           0x0000000000f7be49 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
12 swift           0x0000000000f81c8e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
13 swift           0x0000000000eb1812 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>) + 850
14 swift           0x0000000000eb83dd swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
19 swift           0x0000000000f7be49 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
20 swift           0x0000000000f81c8e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
21 swift           0x0000000000eb1812 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>) + 850
22 swift           0x0000000000eb83dd swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
24 swift           0x0000000000f33bb6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
25 swift           0x0000000000eeda1d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
26 swift           0x0000000000c737f9 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d9aa7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
29 swift           0x00000000007a5988 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28379-swift-constraints-constraintsystem-diagnosefailureforexpr.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28379-swift-constraints-constraintsystem-diagnosefailureforexpr-2c9cbc.o
1.	While type-checking expression at [validation-test/compiler_crashers/28379-swift-constraints-constraintsystem-diagnosefailureforexpr.swift:10:1 - line:10:5] RangeText="!()*0"
2.	While type-checking expression at [validation-test/compiler_crashers/28379-swift-constraints-constraintsystem-diagnosefailureforexpr.swift:10:1 - line:10:3] RangeText="!()"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-26 22:00:13 +02:00
Slava Pestov
9a32575cbf Merge pull request #3738 from slavapestov/remove-protocol-typealias-flag
Remove -enable-protocol-typealiases staging flag
2016-07-26 11:41:49 -07:00
David Farler
4a57e647e6 Merge pull request #3762 from bitjammer/se-0081-diagnostic-and-crashes
[SE-0081] Warn on deprecated where clause inside angle brackets
2016-07-26 09:09:30 -07:00
Doug Gregor
5cce5c4d1d [Parser] Refactor parsing of calls and call-like expressions.
Rather than parsing the call arguments (or similar, e.g., subscript)
as a parenthesized expression or tuple, then later reworking that
ParenExpr/TupleExpr if a trailing closure comes along, then digging
through that ParenExpr/TupleExpr to pull out the arguments and
trailing closure... just parse the expression list and trailing
closure together, then directly form the appropriate AST node with
arguments/labels/label locations/trailing closure.

Fixes rdar://problem/19804707, which is an issue where trailing
closures weren't working with unresolved member expressions (e.g.,
".foo {... }"), and is a stepping-stone to SE-0111.
2016-07-26 08:40:11 -07:00
David Farler
7bfaeb57f1 [SE-0081] Warn on deprecated where clause inside angle brackets
and provide a fix-it to move it to the new location as referenced
in SE-0081.

Fix up a few stray places in the standard library that is still using
the old syntax.

Update any ./test files that aren't expecting the new warning/fix-it
in -verify mode.

While investigating what I thought was a new crash due to this new
diagnostic, I discovered two sources of quite a few compiler crashers
related to unterminated generic parameter lists, where the right
angle bracket source location was getting unconditionally set to
the current token, even though it wasn't actually a '>'.
2016-07-26 01:41:10 -07:00
Slava Pestov
1ae8e37058 Remove -enable-protocol-typealiases staging flag
It looks like migration fixits are done, and this doesn't
expose any new bugs that were not possible before, because
you could already define typealiases inside protocol
extensions.

To prevent some compiler_crasher regressions, add a simple
circularity-breaking hack. I'll need to do a sweep to clean
these up some day soon.
2016-07-25 23:18:49 -07:00
Manav Gabhawala
d06d4e5ad7 [AST][Sema] Fixes the IterativeTypeChecker and better manages circular protocol inheritance
The IterativeTypeChecker now use loops instead of recursion to help keep the stack size low
We diagnose circular dependencies for protocols in a more efficient manner and also prevent the possibility of infinite loops
2016-07-25 13:13:13 -07:00
practicalswift
66cdce98d0 [swiftc (73 vs. 5115)] Add crasher in swift::TypeChecker::resolveWitness(...)
Add test case for crash triggered in `swift::TypeChecker::resolveWitness(...)`.

Current number of unresolved compiler crashers: 73 (5115 resolved)

Assertion failure in [`lib/Sema/CSApply.cpp (line 148)`](https://github.com/apple/swift/blob/master/lib/Sema/CSApply.cpp#L148):

```
Assertion `(conforms || replacement->is<ErrorType>() || firstArchetype->getIsRecursive() || isOpenedAnyObject(replacement) || replacement->is<GenericTypeParamType>()) && "Constraint system missed a conformance?"' failed.

When executing: swift::Type swift::constraints::Solution::computeSubstitutions(swift::Type, swift::DeclContext *, swift::Type, swift::constraints::ConstraintLocator *, SmallVectorImpl<swift::Substitution> &) const
```

Assertion context:

```
      assert((conforms ||
              replacement->is<ErrorType>() ||
              firstArchetype->getIsRecursive() ||
              isOpenedAnyObject(replacement) ||
              replacement->is<GenericTypeParamType>()) &&
             "Constraint system missed a conformance?");
      (void)conforms;

      assert(conformance ||
             replacement->is<ErrorType>() ||
             replacement->hasDependentProtocolConformances());
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/CSApply.cpp:148: swift::Type swift::constraints::Solution::computeSubstitutions(swift::Type, swift::DeclContext *, swift::Type, swift::constraints::ConstraintLocator *, SmallVectorImpl<swift::Substitution> &) const: Assertion `(conforms || replacement->is<ErrorType>() || firstArchetype->getIsRecursive() || isOpenedAnyObject(replacement) || replacement->is<GenericTypeParamType>()) && "Constraint system missed a conformance?"' failed.
14 swift           0x0000000000f1428c swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 668
15 swift           0x000000000113166b swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 171
16 swift           0x0000000000f13c20 swift::TypeChecker::findWitnessedObjCRequirements(swift::ValueDecl const*, bool) + 368
32 swift           0x0000000000ec9406 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
35 swift           0x0000000000f3182a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
36 swift           0x0000000000f3168e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
37 swift           0x0000000000f32253 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
39 swift           0x0000000000eecb01 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
40 swift           0x0000000000c73279 swift::CompilerInstance::performSema() + 3289
42 swift           0x00000000007d94b7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
43 swift           0x00000000007a54b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28378-swift-typechecker-resolvewitness.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28378-swift-typechecker-resolvewitness-1fc026.o
1.	While type-checking '<' at validation-test/compiler_crashers/28378-swift-typechecker-resolvewitness.swift:10:1
2.	While type-checking 'C' at validation-test/compiler_crashers/28378-swift-typechecker-resolvewitness.swift:10:13
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-24 01:30:29 +02:00
practicalswift
89c42cc7c1 [swiftc (72 vs. 5115)] Add crasher in swift::Expr::walk(...)
Add test case for crash triggered in `swift::Expr::walk(...)`.

Current number of unresolved compiler crashers: 72 (5115 resolved)

Assertion failure in [`lib/Sema/CSApply.cpp (line 683)`](https://github.com/apple/swift/blob/master/lib/Sema/CSApply.cpp#L683):

```
Assertion `baseTy->isAnyExistentialType() && "Type must be existential"' failed.

When executing: swift::Expr *(anonymous namespace)::ExprRewriter::openExistentialReference(swift::Expr *, swift::ArchetypeType *, swift::ValueDecl *)
```

Assertion context:

```
      if (auto metaTy = baseTy->getAs<AnyMetatypeType>()) {
        isMetatype = true;
        baseTy = metaTy->getInstanceType();
      }

      assert(baseTy->isAnyExistentialType() && "Type must be existential");

      // If the base was an lvalue but it will only be treated as an
      // rvalue, turn the base into an rvalue now. This results in
      // better SILGen.
      if (isLValue &&
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/CSApply.cpp:683: swift::Expr *(anonymous namespace)::ExprRewriter::openExistentialReference(swift::Expr *, swift::ArchetypeType *, swift::ValueDecl *): Assertion `baseTy->isAnyExistentialType() && "Type must be existential"' failed.
13 swift           0x0000000001082adc swift::Expr::walk(swift::ASTWalker&) + 108
14 swift           0x0000000000f5e782 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
15 swift           0x0000000000eb74ea swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
16 swift           0x0000000000eb8600 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
17 swift           0x0000000000eb9325 swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 373
21 swift           0x0000000000f31c7d swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 845
22 swift           0x0000000000f31682 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 34
23 swift           0x0000000000f32253 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000eecb01 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c73279 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d94b7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
29 swift           0x00000000007a54b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28377-swift-expr-walk.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28377-swift-expr-walk-38fbfa.o
1.	While type-checking 'init' at validation-test/compiler_crashers/28377-swift-expr-walk.swift:10:10
2.	While type-checking expression at [validation-test/compiler_crashers/28377-swift-expr-walk.swift:10:53 - line:10:57] RangeText="A().a"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-23 11:14:23 +02:00
practicalswift
eae6a75d92 [swiftc (71 vs. 5115)] Add crasher in swift::constraints::ConstraintSystem::diagnoseFailureForExpr(...)
Add test case for crash triggered in `swift::constraints::ConstraintSystem::diagnoseFailureForExpr(...)`.

Current number of unresolved compiler crashers: 71 (5115 resolved)

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

```
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::AnyMetatypeType, Y = swift::TypeBase]
```

Assertion context:

```
                          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:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::AnyMetatypeType, Y = swift::TypeBase]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
9  swift           0x0000000000f7d2fa swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 8698
10 swift           0x0000000000f8085e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
11 swift           0x0000000000eb0882 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>) + 850
12 swift           0x0000000000eb744d swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
13 swift           0x0000000000eb9154 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 180
14 swift           0x0000000000eb92ab swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 251
18 swift           0x0000000000f3182a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
19 swift           0x0000000000f3168e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
20 swift           0x0000000000f32253 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
22 swift           0x0000000000eecb01 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
23 swift           0x0000000000c73279 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007d94b7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
26 swift           0x00000000007a54b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28376-swift-constraints-constraintsystem-diagnosefailureforexpr.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28376-swift-constraints-constraintsystem-diagnosefailureforexpr-9a6535.o
1.	While type-checking declaration 0x5cf0350 at validation-test/compiler_crashers/28376-swift-constraints-constraintsystem-diagnosefailureforexpr.swift:11:5
2.	While type-checking expression at [validation-test/compiler_crashers/28376-swift-constraints-constraintsystem-diagnosefailureforexpr.swift:11:9 - line:11:9] RangeText="c"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-23 05:40:08 +02:00