Commit Graph

1575 Commits

Author SHA1 Message Date
practicalswift
1b166a6891 [swiftc] Add test case for crash triggered in swift::NameAliasType::getSinglyDesugaredType()
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Decl.h:2463: swift::Type swift::TypeAliasDecl::getUnderlyingType() const: Assertion `!UnderlyingTy.getType().isNull() && "getting invalid underlying type"' failed.
8  swift           0x0000000001106262 swift::NameAliasType::getSinglyDesugaredType() + 146
9  swift           0x00000000011022e6 swift::TypeBase::getCanonicalType() + 486
10 swift           0x00000000011023fe swift::TypeBase::getCanonicalType() + 766
11 swift           0x00000000010eeb47 swift::removeShadowedDecls(llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::ModuleDecl const*, swift::LazyResolver*) + 311
16 swift           0x00000000010d0c86 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1174
17 swift           0x0000000000edc344 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
18 swift           0x0000000000e86f78 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3864
20 swift           0x000000000104e623 swift::Expr::walk(swift::ASTWalker&) + 19
21 swift           0x0000000000e87797 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>) + 119
22 swift           0x0000000000e8e152 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
23 swift           0x0000000000e8f2a7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
24 swift           0x0000000000e8f4bb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
26 swift           0x0000000000e9bbf9 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 4153
27 swift           0x00000000010f220c swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2652
28 swift           0x00000000010f0aa5 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2469
29 swift           0x0000000000edaf3b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
32 swift           0x0000000000f0b97e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
34 swift           0x0000000000f0c984 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
35 swift           0x0000000000f0b870 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
38 swift           0x0000000000e9b001 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1089
43 swift           0x0000000000ea0546 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
44 swift           0x0000000000ec37f2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 994
45 swift           0x0000000000c58c79 swift::CompilerInstance::performSema() + 3289
47 swift           0x00000000007d6eef swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2863
48 swift           0x00000000007a2ef8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28298-swift-namealiastype-getsinglydesugaredtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28298-swift-namealiastype-getsinglydesugaredtype-defc2e.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28298-swift-namealiastype-getsinglydesugaredtype.swift:10:1
2.	While type-checking 'e' at validation-test/compiler_crashers/28298-swift-namealiastype-getsinglydesugaredtype.swift:10:9
3.	While resolving type a at [validation-test/compiler_crashers/28298-swift-namealiastype-getsinglydesugaredtype.swift:10:21 - line:10:21] RangeText="a"
4.	While type-checking expression at [validation-test/compiler_crashers/28298-swift-namealiastype-getsinglydesugaredtype.swift:11:7 - line:11:7] 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-05-29 09:25:14 +02:00
Dmitri Gribenko
f5fa26231c Merge pull request #2759 from practicalswift/swiftc-28297-swift-lookupvisibledecls
[swiftc] Add test case for crash triggered in swift::lookupVisibleDecls(…)
2016-05-28 17:38:55 -07:00
practicalswift
5a3005b86b [swiftc] Add test case for crash triggered in swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc)
Stack trace:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::ClosureExpr, Y = const swift::AbstractClosureExpr]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
8  swift           0x00000000010d08d3 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1971
9  swift           0x0000000000edbc74 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
10 swift           0x0000000000e868a8 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3864
12 swift           0x000000000104df53 swift::Expr::walk(swift::ASTWalker&) + 19
13 swift           0x0000000000e870c7 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>) + 119
14 swift           0x0000000000e8da82 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
17 swift           0x0000000000f0465a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
18 swift           0x0000000000f044be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
19 swift           0x0000000000f05083 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
21 swift           0x0000000000ec3221 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1249
22 swift           0x0000000000c58a39 swift::CompilerInstance::performSema() + 3289
24 swift           0x00000000007d6d6f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2863
25 swift           0x00000000007a2db8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28297-swift-lookupvisibledecls.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28297-swift-lookupvisibledecls-ca545b.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28297-swift-lookupvisibledecls.swift:10:13
2.	While type-checking expression at [validation-test/compiler_crashers/28297-swift-lookupvisibledecls.swift:10:14 - line:10:14] RangeText="p"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-05-28 12:31:21 +02:00
practicalswift
f2f43cb71c [swiftc] Add test case for crash triggered in swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) 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           0x00000000010cc8a6 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 566
9  swift           0x0000000000f1d41a swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 266
10 swift           0x0000000000ea60a7 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3095
13 swift           0x0000000000e9fe76 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift           0x0000000000f0465a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
17 swift           0x0000000000f044be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
18 swift           0x0000000000f05083 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
20 swift           0x0000000000ec3221 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1249
21 swift           0x0000000000c58a39 swift::CompilerInstance::performSema() + 3289
23 swift           0x00000000007d6d6f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2863
24 swift           0x00000000007a2db8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28296-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28296-swift-genericsignature-getsubstitutionmap-92b81d.o
1.	While type-checking 'e' at validation-test/compiler_crashers/28296-swift-genericsignature-getsubstitutionmap.swift:10:45
2.	While type-checking 'A' at validation-test/compiler_crashers/28296-swift-genericsignature-getsubstitutionmap.swift:10:52
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-05-28 11:12:12 +02:00
practicalswift
931c212d6b [swiftc] Add test case for crash triggered in 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*> >)
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Decl.h:2152: swift::Type swift::ValueDecl::getType() const: Assertion `hasType() && "declaration has no type set yet"' failed.
11 swift           0x00000000010e805d 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
12 swift           0x00000000010cdc12 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1730
13 swift           0x0000000000ed9684 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
14 swift           0x0000000000e85b78 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3864
16 swift           0x000000000104b5b3 swift::Expr::walk(swift::ASTWalker&) + 19
17 swift           0x0000000000e86397 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>) + 119
18 swift           0x0000000000e8cd52 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
21 swift           0x0000000000f034f4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
22 swift           0x0000000000f2dd2c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
23 swift           0x0000000000e8cdf1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
24 swift           0x0000000000e8dea7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
25 swift           0x0000000000e8e0bb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000e9a7f9 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 4153
28 swift           0x0000000000f1a87d swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 413
29 swift           0x0000000000ea49d6 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1526
32 swift           0x0000000000e9edc6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000ec0b32 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 994
34 swift           0x0000000000c57d19 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007d6a5f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2863
37 swift           0x00000000007a2aa8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28295-swift-namelookup-lookupvisibledeclsinmodule.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28295-swift-namelookup-lookupvisibledeclsinmodule-623be6.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28295-swift-namelookup-lookupvisibledeclsinmodule.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28295-swift-namelookup-lookupvisibledeclsinmodule.swift:10:16 - line:10:21] RangeText="{H:{}}"
3.	While type-checking expression at [validation-test/compiler_crashers/28295-swift-namelookup-lookupvisibledeclsinmodule.swift:10:17 - line:10:17] RangeText="H"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-05-27 19:01:59 +02:00
practicalswift
9fb87a673d [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::addSuperclassRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::Type, swift::RequirementSource)
Stack trace:

```
swift: /path/to/swift/lib/AST/Module.cpp:922: Optional<swift::ProtocolConformanceRef> swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl *, swift::LazyResolver *): Assertion `inheritedConformance && "We already found the inherited conformance"' failed.
11 swift           0x0000000000fd0afc swift::ArchetypeBuilder::addSuperclassRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::Type, swift::RequirementSource) + 188
14 swift           0x0000000000fd260f swift::ArchetypeBuilder::visitInherited(llvm::ArrayRef<swift::TypeLoc>, llvm::function_ref<bool (swift::Type, swift::SourceLoc)>) + 175
15 swift           0x0000000000fd062a swift::ArchetypeBuilder::addAbstractTypeParamRequirements(swift::AbstractTypeParamDecl*, swift::ArchetypeBuilder::PotentialArchetype*, swift::RequirementSource::Kind, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 426
16 swift           0x0000000000fd09b7 swift::ArchetypeBuilder::addConformanceRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::ProtocolDecl*, swift::RequirementSource, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 471
19 swift           0x0000000000fd260f swift::ArchetypeBuilder::visitInherited(llvm::ArrayRef<swift::TypeLoc>, llvm::function_ref<bool (swift::Type, swift::SourceLoc)>) + 175
20 swift           0x0000000000fd062a swift::ArchetypeBuilder::addAbstractTypeParamRequirements(swift::AbstractTypeParamDecl*, swift::ArchetypeBuilder::PotentialArchetype*, swift::RequirementSource::Kind, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 426
21 swift           0x0000000000fd0455 swift::ArchetypeBuilder::addGenericParameterRequirements(swift::GenericTypeParamDecl*) + 165
22 swift           0x0000000000ed4b17 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 375
23 swift           0x0000000000ed6217 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
24 swift           0x0000000000ed65b6 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
25 swift           0x0000000000e99e1e swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1630
30 swift           0x0000000000e9edc6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000f0217a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
34 swift           0x0000000000f01fde swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
35 swift           0x0000000000f02ba3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
37 swift           0x0000000000ec0c31 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1249
38 swift           0x0000000000c57d19 swift::CompilerInstance::performSema() + 3289
40 swift           0x00000000007d6a5f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2863
41 swift           0x00000000007a2aa8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28294-swift-archetypebuilder-addsuperclassrequirement.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28294-swift-archetypebuilder-addsuperclassrequirement-c14518.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28294-swift-archetypebuilder-addsuperclassrequirement.swift:10:1
2.	While type-checking 'B' at validation-test/compiler_crashers/28294-swift-archetypebuilder-addsuperclassrequirement.swift:11:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-05-26 22:56:48 +02:00
Janek Spaderna
7819da76d1 [Parse] Improve diagnostics in inheritance clauses
Before, a keyword in an inheritance clause would lead to a long list of errors
not really showing what was wrong.
A special case is added to handle protocol composition; in inheritance clauses
the protocols don't have to be composed with 'protocol<>'.
2016-05-25 14:47:51 +02:00
Slava Pestov
0ff0f3c5b9 Sema: Generic classes and subclasses of generic classes now inherit required initializers
Initializers are inherited by synthesizing an implicit decl which
delegates to super.init(). Previously this was only done if the
class and superclass were concrete.

The only thing missing was that we weren't computing an interface
type for the synthesized constructor. There are two steps to this:

- First, we must map the contextual types of the superclass
  initializer's ParamDecls to the subclass generic context.

- Second, we must set the interface type by calling the new
  configureInterfaceType() method, extracted from from
  validateGenericSignature().

Note that configureInterfaceType() now uses the new
AbstractFunctionDecl::hasThrows() flag to set the 'throws' bit on
the function type. Previously, validateGenericFuncSignature()
would look at getThrowsLoc().isValid(), which is not correct for
imported, implicitly-generated or de-serialized decls that 'throw',
because none of those have source location information.

We still don't allow inheriting initializers which have their
own generic parameter list, like 'init<T>(t: T) {...}'. That
requires a little bit more refactoring.

Progress on <rdar://problem/23376955>.
2016-05-21 12:51:51 -07:00
Slava Pestov
09c57d32c7 AST: Fix some nested generics issues exposed by generic initializer inheritance
BoundGenericType::getSubsitutions() would only look at the bound
generic arguments of the innermost type, ignoring parent types.
However, it would then proceed to walk the AllArchetypes list
of all outer generic parameter lists when forming the final
result.

The gatherAllSubstitutions() would also walk through parent types.
As a result, outer generic parameters would appear multiple
times.

Simplify gatherAllSubstitutions() to just skip to the innermost
BoundGenericType, and delegate to getSubsitutions() for the rest.

Most calls to gatherAllSubstitutions() are from SILGen it seems,
and fix only fixes one compiler_crasher.

However an upcoming patch adds a new call to gatherAllSubstitutions()
which caused some crashers to regress, so I'm going to fix it
properly here.
2016-05-21 12:51:50 -07:00
practicalswift
d3a28444ab Add crash case: 28293-irgensilfunction-visitfullapplysite.swift 2016-05-15 19:19:22 +02:00
practicalswift
f7365406b2 [swiftc] Add test case for crash triggered in swift::ValueDecl::setType(swift::Type)
Stack trace:

```
swift: /path/to/swift/lib/AST/Decl.cpp:1655: void swift::ValueDecl::setType(swift::Type): Assertion `!hasType() && "changing type of declaration"' failed.
8  swift           0x000000000108473c swift::ValueDecl::setType(swift::Type) + 92
9  swift           0x0000000000e788cc swift::configureConstructorType(swift::ConstructorDecl*, swift::Type, swift::Type, bool) + 428
14 swift           0x0000000000e7bf36 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
15 swift           0x0000000000e9d962 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
16 swift           0x0000000000c37c0f swift::CompilerInstance::performSema() + 3295
18 swift           0x00000000007c5e46 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2838
19 swift           0x0000000000791ed8 main + 2840
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28292-swift-valuedecl-settype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28292-swift-valuedecl-settype-ee60c6.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28292-swift-valuedecl-settype.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-05-08 19:37:35 +02:00
practicalswift
53629fa09e [swiftc] Add test case for crash triggered in swift::constraints::ConstraintSystem::compareSolutions(swift::constraints::ConstraintSystem&, llvm::ArrayRef<swift::constraints::Solution>, swift::constraints::SolutionDiff const&, unsigned int, unsigned int)
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2026: static swift::Type swift::ArchetypeBuilder::mapTypeIntoContext(swift::DeclContext *, swift::Type, swift::LazyResolver *): Assertion `genericParams && "Missing generic parameters for dependent context"' failed.
10 swift           0x0000000000f509cc swift::constraints::ConstraintSystem::compareSolutions(swift::constraints::ConstraintSystem&, llvm::ArrayRef<swift::constraints::Solution>, swift::constraints::SolutionDiff const&, unsigned int, unsigned int) + 1580
11 swift           0x0000000000f52114 swift::constraints::ConstraintSystem::findBestSolution(llvm::SmallVectorImpl<swift::constraints::Solution>&, bool) + 372
12 swift           0x0000000000f69c29 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 121
13 swift           0x0000000000e5fcc2 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>) + 674
14 swift           0x0000000000e66452 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
19 swift           0x0000000000f1fb79 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
20 swift           0x0000000000f24b50 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4064
21 swift           0x0000000000e5fcf4 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>) + 724
22 swift           0x0000000000e66452 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
23 swift           0x0000000000e675a7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
24 swift           0x0000000000e677bb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000e78426 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
30 swift           0x0000000000ed8bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
31 swift           0x0000000000ed8a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
32 swift           0x0000000000ed95c8 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
34 swift           0x0000000000e99f64 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1268
35 swift           0x0000000000c37c1f swift::CompilerInstance::performSema() + 3295
37 swift           0x00000000007c5de6 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2838
38 swift           0x0000000000791e78 main + 2840
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28291-swift-constraints-constraintsystem-comparesolutions.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28291-swift-constraints-constraintsystem-comparesolutions-71a91c.o
1.	While type-checking 'b' at validation-test/compiler_crashers/28291-swift-constraints-constraintsystem-comparesolutions.swift:10:45
2.	While type-checking declaration 0x5342958 at validation-test/compiler_crashers/28291-swift-constraints-constraintsystem-comparesolutions.swift:10:56
3.	While type-checking expression at [validation-test/compiler_crashers/28291-swift-constraints-constraintsystem-comparesolutions.swift:10:62 - line:10:64] RangeText="b<T"
4.	While type-checking expression at [validation-test/compiler_crashers/28291-swift-constraints-constraintsystem-comparesolutions.swift:10:62 - line:10:62] 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-05-07 12:46:54 +02:00
practicalswift
b321f86a01 [swiftc] Add test case for crash triggered in swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*)
Stack trace:

```
6  swift           0x00000000030e89fd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
14 swift           0x0000000000f1fb79 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
15 swift           0x0000000000f24b50 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4064
16 swift           0x0000000000e5fcf4 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>) + 724
17 swift           0x0000000000e66452 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
20 swift           0x0000000000ed8bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
21 swift           0x0000000000ed8a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
22 swift           0x0000000000ed95c8 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
24 swift           0x0000000000e99f64 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1268
25 swift           0x0000000000c37c1f swift::CompilerInstance::performSema() + 3295
27 swift           0x00000000007c5de6 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2838
28 swift           0x0000000000791e78 main + 2840
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28290-swift-constraints-constraintsystem-diagnosefailureforexpr.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28290-swift-constraints-constraintsystem-diagnosefailureforexpr-e5f947.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28290-swift-constraints-constraintsystem-diagnosefailureforexpr.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28290-swift-constraints-constraintsystem-diagnosefailureforexpr.swift:9:8 - line:10:7] RangeText="{String($0}{u
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-05-06 19:22:37 +02:00
Mark Lacey
0eb8d01b38 Fix a crasher in the archetype builder.
This particular crasher very rarely didn't crash, causing mayhem with
false failures on the builders.

We were keeping a reference to a vector that could be reallocated in a
recursive call back into the same function. Instead, tend towards
looking up the vector in the map each time we need it.
2016-05-05 16:09:54 -07:00
practicalswift
ac6af6a475 [swiftc] Add test case for crash triggered in swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2051: auto swift::ArchetypeBuilder::mapTypeIntoContext(Module *, swift::GenericParamList *, swift::Type, swift::LazyResolver *)::(anonymous class)::operator()(swift::Type) const: Assertion `genericParamsDepth >= depth' failed.
9  swift           0x00000000010d7dc4 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
10 swift           0x00000000010d8060 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 704
11 swift           0x00000000010d866c swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 2252
12 swift           0x0000000000fa689b swift::ArchetypeBuilder::mapTypeIntoContext(swift::DeclContext*, swift::Type, swift::LazyResolver*) + 171
13 swift           0x00000000010d4dd4 swift::TypeBase::getSuperclass(swift::LazyResolver*) + 244
14 swift           0x0000000000e7e25d swift::TypeChecker::defineDefaultConstructor(swift::NominalTypeDecl*) + 109
15 swift           0x0000000000e7d3a3 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1411
20 swift           0x0000000000e77716 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
23 swift           0x0000000000ed91fa swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
24 swift           0x0000000000f031ac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
25 swift           0x0000000000e657e1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
27 swift           0x0000000000ed9346 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
28 swift           0x0000000000e991bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1117
29 swift           0x0000000000c36eef swift::CompilerInstance::performSema() + 3295
31 swift           0x00000000007c5006 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2838
32 swift           0x0000000000791b08 main + 2840
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28289-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28289-swift-type-transform-3028ba.o
1.	While type-checking expression at [validation-test/compiler_crashers/28289-swift-type-transform.swift:10:1 - line:11:9] RangeText="{class B<t{typealias d<a>:S<a>class a:d
2.	While type-checking 'B' at validation-test/compiler_crashers/28289-swift-type-transform.swift:10:2
3.	While defining default constructor for 'a' at validation-test/compiler_crashers/28289-swift-type-transform.swift:10:31
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-05-01 12:36:54 +02:00
Doug Gregor
04f4552d07 Fixed a crasher... 2016-04-28 22:47:00 -07:00
Joe Pamer
75f1dce6c1 Update crasher fixed by 2cdd7d64e1 2016-04-26 18:20:26 -07:00
practicalswift
07324e2cc6 [swiftc] Add test case for crash triggered in swift::GenericParamList::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) 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           0x00000000010cff58 swift::GenericParamList::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 1080
9  swift           0x0000000000ed957c swift::TypeChecker::applyUnboundGenericArguments(swift::UnboundGenericType*, swift::SourceLoc, swift::DeclContext*, llvm::MutableArrayRef<swift::TypeLoc>, bool, swift::GenericTypeResolver*) + 1164
10 swift           0x0000000000ed8f9f swift::TypeChecker::applyGenericArguments(swift::Type, swift::SourceLoc, swift::DeclContext*, swift::GenericIdentTypeRepr*, bool, swift::GenericTypeResolver*) + 431
14 swift           0x0000000000ed988e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
16 swift           0x0000000000eda8a4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
17 swift           0x0000000000ed978a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
18 swift           0x0000000000ea7162 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 690
19 swift           0x0000000000ea8597 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
20 swift           0x0000000000ea8936 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
21 swift           0x0000000000e6cf7f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 367
22 swift           0x000000000107b917 swift::ProtocolDecl::existentialTypeSupportedSlow(swift::LazyResolver*) + 151
26 swift           0x0000000001015ff4 swift::Decl::walk(swift::ASTWalker&) + 20
27 swift           0x0000000000eddeed swift::TypeChecker::checkUnsupportedProtocolType(swift::Decl*) + 157
29 swift           0x0000000000e6d251 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1089
34 swift           0x0000000000e72306 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
35 swift           0x0000000000e93d82 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
36 swift           0x0000000000c339ef swift::CompilerInstance::performSema() + 3295
38 swift           0x00000000007c4556 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2838
39 swift           0x0000000000791068 main + 2840
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28288-swift-genericparamlist-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28288-swift-genericparamlist-getsubstitutionmap-b0dd35.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28288-swift-genericparamlist-getsubstitutionmap.swift:10:1
2.	While type-checking 'B' at validation-test/compiler_crashers/28288-swift-genericparamlist-getsubstitutionmap.swift:11:1
3.	While resolving type B<Int> at [validation-test/compiler_crashers/28288-swift-genericparamlist-getsubstitutionmap.swift:12:16 - line:12:21] RangeText="B<Int>"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-04-24 22:33:25 +02:00
Manav Gabhawala
8f4f37f072 [Sema] Fixes infinite recursion when inheriting from a member of the same type 2016-04-13 18:18:09 -04:00
John McCall
0d77281556 This test doesn't crash anymore. 2016-04-11 15:14:43 -07:00
practicalswift
5ddf448717 [swiftc] Add test case for crash triggered in swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Decl.h:2447: swift::Type swift::TypeAliasDecl::getUnderlyingType() const: Assertion `!UnderlyingTy.getType().isNull() && "getting invalid underlying type"' failed.
8  swift           0x00000000010e5c8f swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 6879
9  swift           0x00000000010de214 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
10 swift           0x0000000000fb51b7 swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type) + 183
16 swift           0x0000000000e8ca96 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 swift           0x0000000000eaf832 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
18 swift           0x0000000000ce18ff swift::CompilerInstance::performSema() + 3295
20 swift           0x000000000079296b frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2523
21 swift           0x000000000078d5b5 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28287-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28287-swift-type-transform-47ce9c.o
1.	While type-checking 'b' at validation-test/compiler_crashers/28287-swift-type-transform.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-04-09 08:06:51 +02:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
practicalswift
ed9714fa00 [swiftc] Add test case for crash triggered in swift::TypeChecker::applyUnboundGenericArguments(swift::UnboundGenericType*, swift::SourceLoc, swift::DeclContext*, llvm::MutableArrayRef<swift::TypeLoc>, bool, swift::GenericTypeResolver*)
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckType.cpp:484: swift::Type swift::TypeChecker::applyUnboundGenericArguments(swift::UnboundGenericType *, swift::SourceLoc, swift::DeclContext *, MutableArrayRef<swift::TypeLoc>, bool, swift::GenericTypeResolver *): Assertion `TAD->getGenericParams()->getAllArchetypes().size() == genericArgs.size() && "argument arity mismatch"' failed.
8  swift           0x0000000000ee8e4b swift::TypeChecker::applyUnboundGenericArguments(swift::UnboundGenericType*, swift::SourceLoc, swift::DeclContext*, llvm::MutableArrayRef<swift::TypeLoc>, bool, swift::GenericTypeResolver*) + 1259
9  swift           0x0000000000ee880f swift::TypeChecker::applyGenericArguments(swift::Type, swift::SourceLoc, swift::DeclContext*, swift::GenericIdentTypeRepr*, bool, swift::GenericTypeResolver*) + 431
13 swift           0x0000000000ee8fde 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           0x0000000000ee9ef4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
16 swift           0x0000000000ee8eda swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
17 swift           0x0000000000fa283a swift::IterativeTypeChecker::processResolveTypeDecl(swift::TypeDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 202
18 swift           0x0000000000f7f2cd swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
21 swift           0x0000000000e7f3eb swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3739
23 swift           0x0000000000e84056 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
24 swift           0x0000000000ea6df2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
25 swift           0x0000000000cdd0bf swift::CompilerInstance::performSema() + 3295
27 swift           0x0000000000790c7f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495
28 swift           0x000000000078b6f5 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28286-swift-typechecker-applyunboundgenericarguments.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28286-swift-typechecker-applyunboundgenericarguments-a4ff63.o
1.	While type-checking 'B' at validation-test/compiler_crashers/28286-swift-typechecker-applyunboundgenericarguments.swift:10:24
2.	While type-checking 'B' at validation-test/compiler_crashers/28286-swift-typechecker-applyunboundgenericarguments.swift:10:41
3.	While resolving type B<T> at [validation-test/compiler_crashers/28286-swift-typechecker-applyunboundgenericarguments.swift:10:56 - line:10:59] RangeText="B<T>"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-04-02 17:33:55 +02:00
practicalswift
99b89d3bd5 Merge pull request #2018 from practicalswift/remove-crashes-without-apache-license-header
[crashers] Remove 49 fixed crash cases without explicit Apache license header
2016-04-02 09:14:17 +02:00
swift-ci
700bb5eb0f Merge pull request #1960 from practicalswift/swiftc-28284-swift-cantype-isreferencetypeimpl 2016-04-01 17:34:36 -07:00
practicalswift
6a3af35c36 [crashers] Remove crash cases without explicit Apache license header. 2016-04-01 23:48:37 +02:00
practicalswift
7fc06d4981 [swiftc] Add test case for crash triggered in swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*)
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Pattern.h:111: swift::Type swift::Pattern::getType() const: Assertion `hasType()' failed.
8  swift           0x0000000000ebebae swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 1198
9  swift           0x0000000000e720ed swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 189
13 swift           0x0000000000ee251a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
14 swift           0x0000000000f0c66c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
15 swift           0x0000000000e703ca swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
17 swift           0x0000000000ee2666 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
18 swift           0x0000000000ea523d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1117
19 swift           0x0000000000cdbaef swift::CompilerInstance::performSema() + 3279
21 swift           0x000000000079001c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
22 swift           0x000000000078aa95 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28285-swift-typechecker-typecheckpattern.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28285-swift-typechecker-typecheckpattern-437ef8.o
1.	While type-checking expression at [validation-test/compiler_crashers/28285-swift-typechecker-typecheckpattern.swift:10:10 - line:10:25] RangeText="{if let f as a:{"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-31 23:27:18 +02:00
practicalswift
2443bb593f [crashers] Add license headers for crash case #28180
Crash case originally submitted here:
https://github.com/practicalswift/swift-compiler-crashes/pull/96

Apache licensing approval given here:
https://github.com/apple/swift/pull/1649
2016-03-31 22:23:46 +02:00
practicalswift
3bf9216764 [crashers] Add license headers. 2016-03-31 21:33:11 +02:00
practicalswift
2851522205 [swiftc] Add test case for crash triggered in swift::CanType::isReferenceTypeImpl(swift::CanType, bool)
Stack trace:

```
6  swift           0x00000000031482cd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
7  swift           0x00000000010ccce3 swift::CanType::isReferenceTypeImpl(swift::CanType, bool) + 419
8  swift           0x0000000000f8cf0e swift::TypeChecker::checkOwnershipAttr(swift::VarDecl*, swift::OwnershipAttr*) + 190
9  swift           0x0000000000f8cc5c swift::TypeChecker::checkTypeModifyingDeclAttributes(swift::VarDecl*) + 76
10 swift           0x0000000000ebaa37 swift::TypeChecker::coercePatternToType(swift::Pattern*&, swift::DeclContext*, swift::Type, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 2295
11 swift           0x0000000000eba066 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 1062
16 swift           0x0000000000e796d7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 6423
17 swift           0x00000000010bc7ac swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3612
18 swift           0x00000000010bae70 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2400
19 swift           0x0000000000eb6e8b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
22 swift           0x0000000000ee2c9e 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           0x0000000000ee3bb4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
25 swift           0x0000000000ee2b9a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
26 swift           0x0000000000f9b2ef swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 159
27 swift           0x0000000000f78a8d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
28 swift           0x0000000000e74b89 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
29 swift           0x0000000000e782f6 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1334
31 swift           0x0000000000e7d8c6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
32 swift           0x0000000000ea0702 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
33 swift           0x0000000000cd703f swift::CompilerInstance::performSema() + 3087
35 swift           0x000000000078f80c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
36 swift           0x000000000078a285 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28284-swift-cantype-isreferencetypeimpl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28284-swift-cantype-isreferencetypeimpl-051e9e.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28284-swift-cantype-isreferencetypeimpl.swift:9:1
2.	While resolving type e at [validation-test/compiler_crashers/28284-swift-cantype-isreferencetypeimpl.swift:9:33 - line:9:33] RangeText="e"
3.	While type-checking 'A' at validation-test/compiler_crashers/28284-swift-cantype-isreferencetypeimpl.swift:9:10
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-30 23:24:37 +02:00
Manav Gabhawala
7862f104c9 [Parser] Cleans up parsing of parameter attributes. Implements SE-0053. Fixes SR-979, SR-1020 and cleans up implementation of SE-0003. Provides better fix-its and diagnostics for misplaced 'inout' and prohibits 'var' and 'let' from parameter attributes 2016-03-29 13:55:46 -04:00
practicalswift
fc333ba4fe [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::finalize(swift::SourceLoc)
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1683: swift::Identifier typoCorrectNestedType(ArchetypeBuilder::PotentialArchetype *): Assertion `dist > 0 && "nested type should have matched associated type"' failed.
8  swift           0x0000000000f940a1 swift::ArchetypeBuilder::finalize(swift::SourceLoc) + 2209
9  swift           0x0000000000ea4c07 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 183
10 swift           0x0000000000ea4f76 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
11 swift           0x0000000000e682cf swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 367
12 swift           0x00000000010abe8c swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3612
13 swift           0x00000000010aa550 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2400
14 swift           0x0000000000ea714b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
15 swift           0x0000000000e53e26 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 102
17 swift           0x0000000001009f13 swift::Expr::walk(swift::ASTWalker&) + 19
18 swift           0x0000000000e5541d 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>) + 125
19 swift           0x0000000000e5bc00 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576
20 swift           0x0000000000e5cdc2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
21 swift           0x0000000000e5cf9b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
26 swift           0x0000000000e6dc66 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
27 swift           0x0000000000e909c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
28 swift           0x0000000000cd4cff swift::CompilerInstance::performSema() + 3087
30 swift           0x000000000078ee8c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
31 swift           0x0000000000789915 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28283-swift-archetypebuilder-finalize.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28283-swift-archetypebuilder-finalize-cbd0df.o
1.	While type-checking declaration 0x6784470 at validation-test/compiler_crashers/28283-swift-archetypebuilder-finalize.swift:11:14
2.	While type-checking expression at [validation-test/compiler_crashers/28283-swift-archetypebuilder-finalize.swift:12:7 - line:12:7] 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-03-28 10:18:19 +02:00
practicalswift
ea600a3623 [swiftc] Add test case for crash triggered in swift::constraints::Solution::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocator*, bool) const
Stack trace:

```
6  swift           0x00000000031374dd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
8  swift           0x0000000000efa916 swift::constraints::Solution::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocator*, bool) const + 326
10 swift           0x0000000000e5bd47 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 903
11 swift           0x0000000000e5cdc2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
12 swift           0x0000000000e5cf9b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
15 swift           0x0000000000e6dc66 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 swift           0x0000000000ecd42a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
19 swift           0x0000000000ef759c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
20 swift           0x0000000000e5bcaa swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
21 swift           0x0000000000e5cdc2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
22 swift           0x0000000000e5cf9b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000e6dc66 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
28 swift           0x0000000000e909c2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
29 swift           0x0000000000cd4cff swift::CompilerInstance::performSema() + 3087
31 swift           0x000000000078ee8c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
32 swift           0x0000000000789915 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28282-swift-constraints-solution-coercetotype-a03df3.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:9:15 - line:10:10] RangeText="(T:{var f:a
3.	While type-checking declaration 0x67a9c78 at validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:10:1
4.	While type-checking expression at [validation-test/compiler_crashers/28282-swift-constraints-solution-coercetotype.swift:10:7 - line:10:10] RangeText="(T:f"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-28 00:56:57 +02:00
practicalswift
cd3c285d0e [swiftc] Add test case for crash triggered in swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*)
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckProtocol.cpp:1826: swift::Substitution getArchetypeSubstitution(swift::TypeChecker &, swift::DeclContext *, swift::ArchetypeType *, swift::Type): Assertion `!resultReplacement->isTypeParameter() && "Can't be dependent"' failed.
11 swift           0x0000000000e9ed19 swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 569
12 swift           0x00000000010a2ddb swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 171
14 swift           0x0000000000e95784 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 404
15 swift           0x0000000000e41e46 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 102
17 swift           0x0000000000ff81f3 swift::Expr::walk(swift::ASTWalker&) + 19
18 swift           0x0000000000e4343d 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>) + 125
19 swift           0x0000000000e49c20 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576
22 swift           0x0000000000eba65a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
23 swift           0x0000000000eba4be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
24 swift           0x0000000000ebb058 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
26 swift           0x0000000000e7f034 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1268
27 swift           0x0000000000ccf8bf swift::CompilerInstance::performSema() + 3087
29 swift           0x000000000078e52c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
30 swift           0x0000000000788fb5 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28281-swift-typechecker-resolvewitness.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28281-swift-typechecker-resolvewitness-f2097b.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28281-swift-typechecker-resolvewitness.swift:17:6
2.	While type-checking expression at [validation-test/compiler_crashers/28281-swift-typechecker-resolvewitness.swift:18:1 - line:18:1] 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-03-24 21:22:00 +01:00
Greg Titus
cce950705a Merge pull request #1699 from gregomni/typealias
[SR-938][AST/Sema] Typealias in protocol extension, spurious conformance failure fixes
2016-03-23 18:54:18 -07:00
practicalswift
082c530743 [swiftc] Add test case for crash triggered in swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*)
Stack trace:

```
swift: /path/to/swift/include/swift/AST/DiagnosticEngine.h:610: swift::InFlightDiagnostic swift::DiagnosticEngine::diagnose(swift::SourceLoc, Diag<ArgTypes...>, typename detail::PassArgument<ArgTypes>::type...) [ArgTypes = <swift::Identifier>]: Assertion `!ActiveDiagnostic && "Already have an active diagnostic"' failed.
12 swift           0x0000000000ebe50e 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           0x0000000000ebf424 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000ebe40a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
16 swift           0x0000000000f763cf swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 159
17 swift           0x0000000000f53a5d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
18 swift           0x0000000000e50a39 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
19 swift           0x00000000010bb6f3 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 2435
20 swift           0x00000000010bae68 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 248
21 swift           0x00000000010be272 swift::ConformanceLookupTable::lookupConformance(swift::ModuleDecl*, swift::NominalTypeDecl*, swift::ProtocolDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) + 50
22 swift           0x0000000001085a51 swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 1137
23 swift           0x0000000000e9b40a swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 106
27 swift           0x0000000000e5f312 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1442
32 swift           0x0000000000e59776 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000e7caaa swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1146
34 swift           0x0000000000ccd3cf swift::CompilerInstance::performSema() + 3087
36 swift           0x000000000078e10c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
37 swift           0x0000000000788b85 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28280-swift-typechecker-resolveidentifiertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28280-swift-typechecker-resolveidentifiertype-6143c3.o
1.	While type-checking 'T' at validation-test/compiler_crashers/28280-swift-typechecker-resolveidentifiertype.swift:10:1
2.	While resolving type A at [validation-test/compiler_crashers/28280-swift-typechecker-resolveidentifiertype.swift:10:38 - line:10:38] 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-03-22 20:00:14 +01:00
gregomni
45fa88c72d [AST/Sema] Typealias in protocol further corner fixes.
Don’t try to find a conformation witness for typealias declarations in
protocols.

Fixed a bug with same type constraint between an alias and a concrete
type - just a bad assumption on my part. Added test for that.

Made archetype builder more resilient in constructing PA trees: it will
work correctly now if the alias destination is a dependent member type
instead of an archetype type. It also handles the case of finding
multiple aliases with the same name along with an associatedtype with
that name, fixing up all the representative ptrs.

Extensions/Nominals that tried to use a protocol's typealias would get a
dependent type as resolved with the protocol's base instead of with the 'Self'
base type of the current extension/nominal, resulting in spurious conformance
failures. So resolve aliases to protocol assoctypes based on the 'Self'
in which they are used.

Also fixed tests to not use common stdlib names, added tests for
typealias in protocol extension and self & recursive aliases. One recent
crasher also fixed.
2016-03-22 07:36:16 -07:00
practicalswift
2b563d8243 [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getNestedType(swift::Identifier, swift::ArchetypeBuilder&)
Stack trace:

```
4  swift           0x0000000000f72f8d swift::ArchetypeBuilder::PotentialArchetype::getNestedType(swift::Identifier, swift::ArchetypeBuilder&) + 797
5  swift           0x0000000000f75bec swift::ArchetypeBuilder::addConformanceRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::ProtocolDecl*, swift::RequirementSource, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 444
6  swift           0x0000000000f77fed swift::ArchetypeBuilder::addRequirement(swift::Requirement const&, swift::RequirementSource) + 317
7  swift           0x0000000000f79ce3 swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, bool, bool) + 515
8  swift           0x0000000000e899c7 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 55
10 swift           0x0000000000e89efc swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 124
13 swift           0x0000000000e53c86 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
14 swift           0x0000000000ec3423 swift::convertStoredVarInProtocolToComputed(swift::VarDecl*, swift::TypeChecker&) + 115
19 swift           0x0000000000e53c86 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
22 swift           0x0000000000eb3a2a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
23 swift           0x0000000000edd9fc swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
24 swift           0x0000000000e41c9a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
26 swift           0x0000000000eb3b76 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
27 swift           0x0000000000e76fad swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1117
28 swift           0x0000000000cc865f swift::CompilerInstance::performSema() + 3087
30 swift           0x000000000078d3ac frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
31 swift           0x0000000000787e25 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28279-swift-archetypebuilder-potentialarchetype-getnestedtype-b5cbd1.o
1.	While type-checking expression at [validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift:9:1 - line:15:11] RangeText="{
2.	While type-checking 'A' at validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift:10:1
3.	While type-checking getter for f at validation-test/compiler_crashers/28279-swift-archetypebuilder-potentialarchetype-getnestedtype.swift:12:5
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-20 18:56:58 +01:00
practicalswift
600259c4ce [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>)
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2223: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &): Assertion `pa && "Missing potential archetype for generic parameter"' failed.
8  swift           0x0000000000f7a3b8 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1576
9  swift           0x0000000000e8b2d1 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 321
10 swift           0x0000000000e8b5b6 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
11 swift           0x0000000000e4e7bc swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1596
12 swift           0x0000000000e4e251 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 209
15 swift           0x0000000001086632 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           0x000000000108d95a swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 3978
17 swift           0x0000000000e8d79b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
20 swift           0x0000000000e972f0 swift::TypeChecker::inferDefaultWitnesses(swift::ProtocolDecl*) + 288
21 swift           0x0000000000e77628 swift::finishTypeChecking(swift::SourceFile&) + 504
22 swift           0x0000000000cc880a swift::CompilerInstance::performSema() + 3514
24 swift           0x000000000078d3ac frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
25 swift           0x0000000000787e25 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28278-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28278-swift-archetypebuilder-getgenericsignature-ed4694.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-20 10:36:14 +01:00
practicalswift
01b8296566 [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>)
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/TinyPtrVector.h:182: EltTy llvm::TinyPtrVector<swift::ArchetypeBuilder::PotentialArchetype *>::front() const [EltTy = swift::ArchetypeBuilder::PotentialArchetype *]: Assertion `!empty() && "vector empty"' failed.
10 swift           0x0000000000f78281 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1089
11 swift           0x0000000000e885f7 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 359
16 swift           0x0000000000e52296 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000eb203a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
20 swift           0x0000000000edc00c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
21 swift           0x0000000000e401aa swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
23 swift           0x0000000000eb2186 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000e755bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1117
25 swift           0x0000000000cc6e2f swift::CompilerInstance::performSema() + 3087
27 swift           0x000000000078d17c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
28 swift           0x0000000000787c45 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28277-swift-archetypebuilder-getgenericsignature-82990f.o
1.	While type-checking expression at [validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift:10:1 - line:13:23] RangeText="{
2.	While type-checking 'A' at validation-test/compiler_crashers/28277-swift-archetypebuilder-getgenericsignature.swift:11:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-19 16:46:21 +01:00
practicalswift
2e3d3dbe09 [swiftc] Add test case for crash triggered in swift::TypeChecker::computeDefaultAccessibility(swift::ExtensionDecl*)
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Decl.h:1716: void swift::ExtensionDecl::setDefaultAndMaxAccessibility(swift::Accessibility, swift::Accessibility): Assertion `!hasDefaultAccessibility() && "default accessibility already set"' failed.
9  swift           0x0000000000e4e9ee swift::TypeChecker::computeDefaultAccessibility(swift::ExtensionDecl*) + 830
10 swift           0x0000000000e4eec9 swift::TypeChecker::computeAccessibility(swift::ValueDecl*) + 633
11 swift           0x0000000000e4f20c swift::TypeChecker::validateAccessibility(swift::ValueDecl*) + 76
12 swift           0x0000000000e4c6d2 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 66
16 swift           0x0000000000e52296 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 swift           0x0000000000e75542 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 994
18 swift           0x0000000000cc6e2f swift::CompilerInstance::performSema() + 3087
20 swift           0x000000000078d17c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
21 swift           0x0000000000787c45 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28276-swift-typechecker-computedefaultaccessibility.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28276-swift-typechecker-computedefaultaccessibility-b0a9ad.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28276-swift-typechecker-computedefaultaccessibility.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-03-18 19:23:14 +01:00
practicalswift
6ba696c276 [swiftc] Add test case for crash triggered in swift::TypeBase::getSuperclass(swift::LazyResolver*)
Stack trace:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::BoundGenericType, Y = swift::TypeBase]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
8  swift           0x000000000109c869 swift::TypeBase::getSuperclass(swift::LazyResolver*) + 857
9  swift           0x0000000000e547ad swift::TypeChecker::defineDefaultConstructor(swift::NominalTypeDecl*) + 109
10 swift           0x0000000000e538f9 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1417
11 swift           0x0000000000e466cd swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 6077
12 swift           0x0000000000e4830f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 527
13 swift           0x0000000000e481d1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 209
14 swift           0x0000000000e481d1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 209
17 swift           0x000000000107f0d2 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
18 swift           0x00000000010863fa swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 3978
19 swift           0x0000000000e879bb swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
22 swift           0x0000000000e91380 swift::TypeChecker::inferDefaultWitnesses(swift::ProtocolDecl*) + 288
23 swift           0x0000000000e717a8 swift::finishTypeChecking(swift::SourceFile&) + 536
24 swift           0x0000000000cc27ea swift::CompilerInstance::performSema() + 3514
26 swift           0x000000000078c25c frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2492
27 swift           0x0000000000786d25 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28275-swift-typebase-getsuperclass.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28275-swift-typebase-getsuperclass-4e8e8d.o
1.	While defining default constructor for 'a' at validation-test/compiler_crashers/28275-swift-typebase-getsuperclass.swift:10:44
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-17 07:51:03 +01:00
practicalswift
7e5bc3a910 [swiftc] Add test case for crash triggered in swift::ValueDecl::isInstanceMember() const
Stack trace:

```
4  swift           0x0000000001040c01 swift::ValueDecl::isInstanceMember() const + 1
10 swift           0x0000000000e8d9fc swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 652
11 swift           0x000000000108c18b swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 171
13 swift           0x0000000000e84684 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 404
14 swift           0x0000000000e309e6 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 102
16 swift           0x0000000000fe1b03 swift::Expr::walk(swift::ASTWalker&) + 19
17 swift           0x0000000000e31fdd 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>) + 125
18 swift           0x0000000000e38720 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576
19 swift           0x0000000000e398e2 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 162
20 swift           0x0000000000e39abb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
25 swift           0x0000000000e4a8b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
26 swift           0x0000000000e6dc92 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1026
27 swift           0x0000000000cbefbf swift::CompilerInstance::performSema() + 3087
29 swift           0x000000000078bb5f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495
30 swift           0x0000000000786625 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28274-swift-valuedecl-isinstancemember.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28274-swift-valuedecl-isinstancemember-23334f.o
1.	While type-checking 'S' at validation-test/compiler_crashers/28274-swift-valuedecl-isinstancemember.swift:9:1
2.	While type-checking expression at [validation-test/compiler_crashers/28274-swift-valuedecl-isinstancemember.swift:10:7 - line:10:7] RangeText="f"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-16 23:55:44 +01:00
practicalswift
90085c2275 [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&)
Stack trace:

```
4  swift           0x0000000000f6acdc swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 28
6  swift           0x000000000109a93d swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 45
7  swift           0x000000000109abc7 swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 695
8  swift           0x000000000109aa49 swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 313
9  swift           0x0000000000f6af7f swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 703
10 swift           0x0000000000f70285 swift::ArchetypeBuilder::getArchetype(swift::GenericTypeParamDecl*) + 53
12 swift           0x0000000000e44e2a swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 506
13 swift           0x0000000001082f2c swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3612
14 swift           0x0000000000e85347 swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 295
16 swift           0x0000000000eaf42e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
18 swift           0x0000000000eb0344 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
19 swift           0x0000000000eaf32a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
20 swift           0x0000000000e80a06 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 582
21 swift           0x0000000000e82047 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
22 swift           0x0000000000e823e6 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
23 swift           0x0000000000e44d9f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 367
26 swift           0x0000000000e4a8b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
27 swift           0x0000000000e6dc92 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1026
28 swift           0x0000000000cbefbf swift::CompilerInstance::performSema() + 3087
30 swift           0x000000000078bb5f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495
31 swift           0x0000000000786625 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28273-swift-archetypebuilder-potentialarchetype-gettype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28273-swift-archetypebuilder-potentialarchetype-gettype-44bd17.o
1.	While type-checking 'S' at validation-test/compiler_crashers/28273-swift-archetypebuilder-potentialarchetype-gettype.swift:5:1
2.	While resolving type S.e at [validation-test/compiler_crashers/28273-swift-archetypebuilder-potentialarchetype-gettype.swift:5:16 - line:5:18] RangeText="S.e"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-16 10:59:46 +01:00
practicalswift
5db8277270 [swiftc] Add test case for crash triggered in swift::Expr::walk(swift::ASTWalker&)
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/Optional.h:138: T &&llvm::Optional<swift::constraints::SelectedOverload>::operator*() && [T = swift::constraints::SelectedOverload]: Assertion `hasVal' failed.
11 swift           0x0000000000fdfea5 swift::Expr::walk(swift::ASTWalker&) + 69
12 swift           0x0000000000ed3e26 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 502
13 swift           0x0000000000e36d5a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
16 swift           0x0000000000ef093b swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 10971
17 swift           0x0000000000ef29a0 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4064
18 swift           0x0000000000e30803 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>) + 787
19 swift           0x0000000000e36cb0 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576
21 swift           0x0000000000ea8986 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
22 swift           0x0000000000e6c27d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1149
23 swift           0x0000000000cbdccf swift::CompilerInstance::performSema() + 3087
25 swift           0x000000000078b89f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495
26 swift           0x0000000000786365 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28272-swift-expr-walk.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28272-swift-expr-walk-29a7d7.o
1.	While type-checking expression at [validation-test/compiler_crashers/28272-swift-expr-walk.swift:6:1 - line:6:3] RangeText=".A["
2.	While type-checking expression at [validation-test/compiler_crashers/28272-swift-expr-walk.swift:6:1 - line:6:3] 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-03-15 11:55:27 +01:00
Ted Kremenek
7772ae7543 Merge pull request #1680 from practicalswift/swiftc-28271-swift-archetypebuilder-getallarchetypes
[swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getAllArchetypes()
2016-03-14 21:35:48 -07:00
practicalswift
2a08c13cee [crashers] Add license headers.
Approvals given in #1649.
2016-03-14 21:59:04 +01:00
practicalswift
defe364a59 Merge pull request #1668 from practicalswift/add-apache-license-header-to-crashers
[crashers] Add license header: Apache License v2.0 with Runtime Library Exception
2016-03-14 21:51:03 +01:00
practicalswift
c3eddb7fb0 [swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::getAllArchetypes()
Stack trace:

```
swift: /path/to/swift/include/swift/AST/Types.h:3616: swift::ArchetypeType *swift::ArchetypeType::NestedType::castToArchetype() const: Assertion `!isConcreteType()' failed.
8  swift           0x0000000000f6cec5 swift::ArchetypeBuilder::getAllArchetypes() + 533
12 swift           0x0000000000e41db1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1089
16 swift           0x0000000000e475d6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000ea6e0a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
20 swift           0x0000000000ed293c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
21 swift           0x0000000000e3550a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746
24 swift           0x0000000000ea5ada swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
25 swift           0x0000000000ea593e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
26 swift           0x0000000000ea64d8 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
28 swift           0x0000000000e6aa74 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1300
29 swift           0x0000000000cbcf5f swift::CompilerInstance::performSema() + 3087
31 swift           0x000000000078b6ff frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495
32 swift           0x00000000007861c5 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28271-swift-archetypebuilder-getallarchetypes.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28271-swift-archetypebuilder-getallarchetypes-7ceb13.o
1.	While type-checking 'b' at validation-test/compiler_crashers/28271-swift-archetypebuilder-getallarchetypes.swift:6:1
2.	While type-checking expression at [validation-test/compiler_crashers/28271-swift-archetypebuilder-getallarchetypes.swift:6:8 - line:9:11] RangeText="{
3.	While type-checking 'P' at validation-test/compiler_crashers/28271-swift-archetypebuilder-getallarchetypes.swift:7:1
4.	While type-checking 'b' at validation-test/compiler_crashers/28271-swift-archetypebuilder-getallarchetypes.swift:8:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-03-14 21:01:58 +01:00
practicalswift
7f5266dea8 [crashers] Add full license header. 2016-03-14 20:53:10 +01:00