Commit Graph

1304 Commits

Author SHA1 Message Date
gregomni
8d02354b76 Return ErrorType for type on invalid extension
This is a better fix for crash 28328 than commit
a870bdbd23. Also fixes additional
crashers.
2016-07-03 14:05:02 -07:00
practicalswift
f5aecc2128 [swiftc] Add 💥 case (😢 → 55, 😀 → 5096) triggered in swift::TypeChecker::typeCheckDecl(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:4247: void (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl *): Assertion `!FD->getType()->hasTypeParameter()' failed.
12 swift           0x0000000000eb1ea6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
15 swift           0x0000000000f19614 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
16 swift           0x0000000000f4594c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
17 swift           0x0000000000ea04e1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
18 swift           0x0000000000ea15f7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
19 swift           0x0000000000ea180b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
21 swift           0x0000000000ead5bd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
26 swift           0x00000000010e9f35 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1189
27 swift           0x0000000000eef7c1 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 305
28 swift           0x0000000000e991e9 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3865
30 swift           0x0000000001066c53 swift::Expr::walk(swift::ASTWalker&) + 19
31 swift           0x0000000000e99a70 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
32 swift           0x0000000000ea0442 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
33 swift           0x0000000000ea15f7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
34 swift           0x0000000000ea180b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
36 swift           0x0000000000ead5bd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
37 swift           0x0000000000f31c6d swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 413
38 swift           0x0000000000eb7ab0 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1536
41 swift           0x0000000000eb1ea6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
42 swift           0x0000000000ed40b2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
43 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
45 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
46 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28341-swift-typechecker-typecheckdecl-658f4b.o
1.	While type-checking 'S' at validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:11:7 - line:11:7] RangeText="o"
3.	While type-checking expression at [validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:15:7 - line:18:8] RangeText="{
4.	While type-checking 'A' at validation-test/compiler_crashers/28341-swift-typechecker-typecheckdecl.swift:16:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-03 10:37:06 +02:00
swift-ci
550bb31e6f Merge pull request #3319 from practicalswift/swiftc-28340-swift-type-getstring 2016-07-02 04:50:45 -07:00
swift-ci
663884f92a Merge pull request #3318 from gregomni/crash28328 2016-07-02 02:14:08 -07:00
practicalswift
a107086667 [swiftc] Add 💥 case (😢 → 55, 😀 → 5095) triggered in swift::Type::getString(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ASTPrinter.cpp:4061: void (anonymous namespace)::TypePrinter::visitArchetypeType(swift::ArchetypeType *): Assertion `GTD && GTD->isProtocolSelf()' failed.
12 swift           0x0000000001037313 swift::Type::getString(swift::PrintOptions const&) const + 163
13 swift           0x0000000000f62ad4 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 2244
14 swift           0x0000000000f67bfe swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
15 swift           0x0000000000e9a3c2 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 850
16 swift           0x0000000000ea0b22 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
17 swift           0x0000000000ea1cd7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
18 swift           0x0000000000ea1eeb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
20 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
23 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
24 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
25 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
27 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
28 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
30 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
31 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28340-swift-type-getstring.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28340-swift-type-getstring-e49a2a.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28340-swift-type-getstring.swift:18:1
2.	While type-checking declaration 0x4e90678 at validation-test/compiler_crashers/28340-swift-type-getstring.swift:18:8
3.	While type-checking expression at [validation-test/compiler_crashers/28340-swift-type-getstring.swift:18:14 - line:18:14] RangeText="1"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-02 11:06:39 +02:00
gregomni
a870bdbd23 Fix for crash 28328. A decl's computeNominalType() can return null, but a bunch of places expect getDeclaredTypeInContext() to never be null so use ErrorType instead. 2016-07-01 23:35:03 -07:00
practicalswift
611c6f577c [swiftc] Add 💥 case (😢 → 54, 😀 → 5095) triggered in swift::TypeChecker::addImplicitConstructors(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:7344: void swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl *): Assertion `!classDecl->hasSuperclass() || classDecl->getSuperclass()->getAnyNominal()->isInvalid() || classDecl->getSuperclass()->getAnyNominal() ->addedImplicitInitializers()' failed.
8  swift           0x0000000000eb8d5a swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 4506
9  swift           0x0000000000eabbed swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5885
10 swift           0x0000000000eacf28 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
15 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
19 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
20 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
22 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
23 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
26 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28339-swift-typechecker-addimplicitconstructors.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28339-swift-typechecker-addimplicitconstructors-bd822a.o
1.	While type-checking getter for d at validation-test/compiler_crashers/28339-swift-typechecker-addimplicitconstructors.swift:10:6
2.	While type-checking 'A' at validation-test/compiler_crashers/28339-swift-typechecker-addimplicitconstructors.swift:10:7
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-02 06:42:06 +02:00
swift-ci
633aee5f42 Merge pull request #3295 from practicalswift/swiftc-28338-swift-genericsignature-getsubstitutionmap 2016-07-01 15:14:31 -07:00
swift-ci
dfe73180b5 Merge pull request #3297 from gregomni/crash28290 2016-07-01 11:41:11 -07:00
gregomni
27b7420fff Fix for crash 28290 in findGenericSubstitutions
Early out needs to check that the types don’t contain UnresolvedType,
not just that they aren’t UnresolvedType at the top level.
2016-07-01 10:48:50 -07:00
practicalswift
9d9141ee5a [swiftc] Add 💥 case (😢 → 54, 😀 → 5094) triggered in swift::GenericSignature::getSubstitutionMap(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/GenericSignature.cpp:413: TypeSubstitutionMap swift::GenericSignature::getSubstitutionMap(ArrayRef<swift::Substitution>) const: Assertion `args.empty() && "did not use all substitutions?!"' failed.
8  swift           0x00000000010e5f63 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 659
9  swift           0x0000000000f32442 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 338
10 swift           0x0000000000eb8833 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3187
19 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
23 swift           0x0000000000f19d46 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000ed47bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
25 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
27 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
28 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28338-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28338-swift-genericsignature-getsubstitutionmap-62e861.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28338-swift-genericsignature-getsubstitutionmap.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-07-01 19:08:58 +02:00
practicalswift
40f8408b07 [swiftc] Add 💥 case (😢 → 53, 😀 → 5094) triggered in swift::TypeBase::getCanonicalType(…)
Add crash case with stack trace:

```
4  swift           0x000000000111aff4 swift::TypeBase::getCanonicalType() + 20
5  swift           0x0000000001133a7d swift::ConformanceLookupTable::getConformance(swift::NominalTypeDecl*, swift::LazyResolver*, swift::ConformanceLookupTable::ConformanceEntry*) + 301
7  swift           0x0000000001134194 swift::ConformanceLookupTable::lookupConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*, swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ProtocolDecl*>*, llvm::SmallVectorImpl<swift::ProtocolConformance*>*, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*) + 692
8  swift           0x00000000011167e4 swift::DeclContext::getLocalConformances(swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*, bool) const + 212
9  swift           0x0000000000ef996e swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 334
16 swift           0x0000000000eb25a6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000f19c04 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
20 swift           0x0000000000f45a2c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
21 swift           0x0000000000ea0bc1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
23 swift           0x0000000000f19d46 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000ed47bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
25 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
27 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
28 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28337-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28337-swift-typebase-getcanonicaltype-1d42b8.o
1.	While type-checking expression at [validation-test/compiler_crashers/28337-swift-typebase-getcanonicaltype.swift:9:1 - line:13:17] RangeText="{
2.	While type-checking 'a' at validation-test/compiler_crashers/28337-swift-typebase-getcanonicaltype.swift:10:1
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-01 15:18:14 +02:00
practicalswift
8f89865e32 [swiftc] Add 💥 case (😢 → 52, 😀 → 5094) triggered in swift::ArchetypeBuilder::addRequirement(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1476: void swift::ArchetypeBuilder::addRequirement(const swift::Requirement &, swift::RequirementSource): Assertion `pa && "Re-introducing invalid requirement"' failed.
8  swift           0x0000000000fee5fb swift::ArchetypeBuilder::addRequirement(swift::Requirement const&, swift::RequirementSource) + 667
9  swift           0x0000000000ff01c3 swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, bool, bool) + 515
10 swift           0x0000000000ffcc45 swift::ASTContext::getOrCreateArchetypeBuilder(swift::CanGenericSignature, swift::ModuleDecl*) + 181
11 swift           0x00000000010e693b swift::GenericSignature::getCanonicalTypeInContext(swift::Type, swift::ModuleDecl&) + 43
12 swift           0x000000000111b56d swift::TypeBase::getCanonicalType() + 1421
17 swift           0x00000000010e9f26 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1174
18 swift           0x0000000000eefd44 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
19 swift           0x0000000000e998c9 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3881
21 swift           0x0000000001066c43 swift::Expr::walk(swift::ASTWalker&) + 19
22 swift           0x0000000000e9a150 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
23 swift           0x0000000000ea0b22 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
26 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
27 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
28 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
30 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
31 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
34 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28336-swift-archetypebuilder-addrequirement.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28336-swift-archetypebuilder-addrequirement-728e64.o
1.	While type-checking 'g' at validation-test/compiler_crashers/28336-swift-archetypebuilder-addrequirement.swift:10:40
2.	While type-checking expression at [validation-test/compiler_crashers/28336-swift-archetypebuilder-addrequirement.swift:10:49 - line:10:49] 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-06-30 13:21:30 +02:00
rjmccall
aa0b05c1a0 Merge pull request #3271 from rjmccall/fix-lookupVisibleDecls-in-AutoClosureExpr
Fix lookupVisibleDecls from inside an AutoClosureExpr.
2016-06-30 01:28:06 -07:00
Doug Gregor
423c1f09da [Type checker] Use call argument matching even with type variables on the left-hand side.
Rather than using a specialized matching rule in the type checker that
depends on having default arguments in types, use call argument
matching consistently.

Note #1: This (correctly) breaks some existing code that depends on
inferring a parameter type of () for a single-argument parameter from
a no-argument function type().

Note #2: This pessimizes a code completion test, where the code
completion engine seems to depend on some quirks of argument
matching. The "type relationship" matching needs non-trivial work.
2016-06-29 20:43:42 -07:00
John McCall
f59c16faac Fix lookupVisibleDecls from inside an AutoClosureExpr. 2016-06-29 19:06:36 -07:00
swift-ci
49b365429e Merge pull request #3260 from practicalswift/swiftc-28335-swift-type-print 2016-06-29 17:25:18 -07:00
John McCall
1e1afc569c Check for lazy signature resolution failure when deciding overloadability. 2016-06-29 13:22:34 -07:00
practicalswift
daf5e47982 [swiftc] Add 💥 case (😢 → 54, 😀 → 5091) triggered in swift::Type::print(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ASTPrinter.cpp:4061: void (anonymous namespace)::TypePrinter::visitArchetypeType(swift::ArchetypeType *): Assertion `GTD && GTD->isProtocolSelf()' failed.
10 swift           0x00000000010360f1 swift::Type::print(swift::ASTPrinter&, swift::PrintOptions const&) const + 49
16 swift           0x0000000001037480 swift::TypeBase::getString(swift::PrintOptions const&) const + 160
18 swift           0x00000000010d8f5b swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 2923
19 swift           0x00000000010d81cf swift::DiagnosticEngine::flushActiveDiagnostic() + 319
20 swift           0x0000000000f17fd9 swift::TypeChecker::checkIgnoredExpr(swift::Expr*) + 377
23 swift           0x0000000000f1888a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
24 swift           0x0000000000f186ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
25 swift           0x0000000000f192b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
27 swift           0x0000000000ed4851 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
28 swift           0x0000000000c62209 swift::CompilerInstance::performSema() + 3289
30 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
31 swift           0x00000000007a49f8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28335-swift-type-print.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28335-swift-type-print-72fd02.o
1.	While type-checking getter for c at validation-test/compiler_crashers/28335-swift-type-print.swift:13:6
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-29 17:10:43 +02:00
practicalswift
c9fecd5d3c [swiftc] Add 💥 case (😢 → 53, 😀 → 5091) triggered in swift::TypeChecker::resolveTypeWitness(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckProtocol.cpp:1811: swift::Substitution getArchetypeSubstitution(swift::TypeChecker &, swift::DeclContext *, swift::ArchetypeType *, swift::Type): Assertion `(archetype != nullptr || isError) && "Should have built archetypes already"' failed.
10 swift           0x0000000000efa15e swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 254
11 swift           0x0000000001112376 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150
12 swift           0x00000000011122b8 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
13 swift           0x0000000001112a86 swift::ProtocolConformance::getTypeWitness(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 6
16 swift           0x0000000001121674 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
17 swift           0x000000000111ad74 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
18 swift           0x0000000000f414df swift::constraints::Solution::computeSubstitutions(swift::Type, swift::DeclContext*, swift::Type, swift::constraints::ConstraintLocator*, llvm::SmallVectorImpl<swift::Substitution>&) const + 943
21 swift           0x00000000010651f5 swift::Expr::walk(swift::ASTWalker&) + 69
22 swift           0x0000000000f44102 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
23 swift           0x0000000000e9f8d1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
27 swift           0x0000000000f60ab9 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
28 swift           0x0000000000f6643e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
29 swift           0x0000000000e990d2 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 850
30 swift           0x0000000000e9f832 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
33 swift           0x0000000000f1751d swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 845
34 swift           0x0000000000f16f22 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 34
35 swift           0x0000000000f17af3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
37 swift           0x0000000000ed3561 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
38 swift           0x0000000000c613b9 swift::CompilerInstance::performSema() + 3289
40 swift           0x00000000007d86c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
41 swift           0x00000000007a4708 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28334-swift-typechecker-resolvetypewitness.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28334-swift-typechecker-resolvetypewitness-1605d2.o
1.	While type-checking 'init' at validation-test/compiler_crashers/28334-swift-typechecker-resolvetypewitness.swift:16:10
2.	While type-checking expression at [<invalid loc> - <invalid loc>]
3.	While type-checking expression at [<invalid loc> - <invalid loc>]
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-28 23:14:14 +02:00
practicalswift
a4924ba249 [swiftc] Add 💥 case (😢 → 52, 😀 → 5091) triggered in swift::TypeDecl::getDeclaredType(…) const
Add crash case with stack trace:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<swift::TypeAliasDecl, const swift::TypeDecl *>::doit(const From *) [To = swift::TypeAliasDecl, From = const swift::TypeDecl *]: Assertion `Val && "isa<> used on a null pointer"' failed.
8  swift           0x00000000010c6972 swift::TypeDecl::getDeclaredType() const + 290
9  swift           0x000000000112329c swift::TypeBase::getMemberSubstitutions(swift::DeclContext const*) + 140
10 swift           0x0000000001123666 swift::TypeBase::getTypeOfMember(swift::ModuleDecl*, swift::Type, swift::DeclContext const*) + 54
12 swift           0x0000000000f1e40e 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           0x0000000000f1f364 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000f1e300 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
20 swift           0x0000000000eb12b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
21 swift           0x0000000000ed3462 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
22 swift           0x0000000000c613b9 swift::CompilerInstance::performSema() + 3289
24 swift           0x00000000007d86c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
25 swift           0x00000000007a4708 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28333-swift-typedecl-getdeclaredtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28333-swift-typedecl-getdeclaredtype-1b3d4b.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28333-swift-typedecl-getdeclaredtype.swift:10:1
2.	While resolving type f.f at [validation-test/compiler_crashers/28333-swift-typedecl-getdeclaredtype.swift:11:8 - line:11:10] RangeText="f.a"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-28 19:08:13 +02:00
practicalswift
8830519342 [swiftc] Add 💥 case (😢 → 51, 😀 → 5091) triggered in swift::ArchetypeBuilder::getGenericSignature(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2250: void collectRequirements(swift::ArchetypeBuilder &, ArrayRef<swift::GenericTypeParamType *>, SmallVectorImpl<swift::Requirement> &): Assertion `pa && "Missing potential archetype for generic parameter"' failed.
8  swift           0x0000000000feee54 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 1604
9  swift           0x0000000000eea3ce swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 318
10 swift           0x0000000000eeae7f swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 111
11 swift           0x0000000000eac1e9 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1833
12 swift           0x00000000011073d3 swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2387
13 swift           0x0000000000eed0eb swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
16 swift           0x0000000000f1e40e 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           0x0000000000f1f364 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
19 swift           0x0000000000f1e300 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
20 swift           0x0000000000fe43af swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 159
21 swift           0x0000000000fbc69d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
22 swift           0x0000000000ea91b9 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
23 swift           0x0000000000eabf5f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1183
24 swift           0x0000000000eabb91 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 209
27 swift           0x0000000001101c7d 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
28 swift           0x00000000010e7fb2 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1730
29 swift           0x0000000000eee584 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
30 swift           0x0000000000e985d9 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3881
32 swift           0x00000000010651c3 swift::Expr::walk(swift::ASTWalker&) + 19
33 swift           0x0000000000e98e60 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
34 swift           0x0000000000e9f832 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
35 swift           0x0000000000ea09e7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
36 swift           0x0000000000ea0bfb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
41 swift           0x0000000000eb12b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
42 swift           0x0000000000ed3462 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
43 swift           0x0000000000c613b9 swift::CompilerInstance::performSema() + 3289
45 swift           0x00000000007d86c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
46 swift           0x00000000007a4708 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28332-swift-archetypebuilder-getgenericsignature.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28332-swift-archetypebuilder-getgenericsignature-9505f7.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28332-swift-archetypebuilder-getgenericsignature.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28332-swift-archetypebuilder-getgenericsignature.swift:10:15 - line:10:15] RangeText="a"
3.	While resolving type Q at [validation-test/compiler_crashers/28332-swift-archetypebuilder-getgenericsignature.swift:23:1 - line:23:1] RangeText="Q"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-26 17:01:24 +02:00
swift-ci
104a72fe8e Merge pull request #3189 from practicalswift/swiftc-28331-swift-createdesignatedinitoverride 2016-06-24 01:50:05 -07:00
Slava Pestov
004f145ba4 Sema: Fix some problems with generic typealiases
The underlying type can now refer to generic parameters from an
outer context, and we allow qualified and unqualified access to
such typealiases.

One problem remains, with specializations of generic typealiases
in expression parsing context, marked with FIXME in the test.
2016-06-23 23:14:38 -07:00
practicalswift
40c0514859 [swiftc] Add 💥 case (😢 → 51, 😀 → 5090) triggered in swift::createDesignatedInitOverride(…)
Add crash case with stack trace:

```
5  swift           0x0000000000f21393 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 2003
6  swift           0x0000000000ea76a3 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3187
13 swift           0x0000000000ea1416 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift           0x0000000000f08594 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
17 swift           0x0000000000f342dc swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
18 swift           0x0000000000e8fa31 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
21 swift           0x0000000000f0721a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
22 swift           0x0000000000f0707e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
23 swift           0x0000000000f07c43 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000ec36c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c590c9 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d73e9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a3428 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28331-swift-createdesignatedinitoverride.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28331-swift-createdesignatedinitoverride-86a961.o
1.	While type-checking declaration 0x50f5a00 at validation-test/compiler_crashers/28331-swift-createdesignatedinitoverride.swift:9:5
2.	While type-checking expression at [validation-test/compiler_crashers/28331-swift-createdesignatedinitoverride.swift:9:6 - line:9:48] RangeText="{class a{enum S<U:a{class B:a{init}}class a"
3.	While type-checking 'a' at validation-test/compiler_crashers/28331-swift-createdesignatedinitoverride.swift:9:7
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-24 08:14:09 +02:00
practicalswift
a18e4afa1e [swiftc] Add 💥 case (😢 → 50, 😀 → 5090) triggered in swift::GenericParamList::getSubstitutionMap(…) const
Add crash case with 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           0x000000000111e0e8 swift::GenericParamList::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 1080
9  swift           0x0000000000f1b80b swift::TypeChecker::applyUnboundGenericArguments(swift::UnboundGenericType*, swift::SourceLoc, swift::DeclContext*, llvm::MutableArrayRef<swift::TypeLoc>, bool, swift::GenericTypeResolver*) + 1195
11 swift           0x000000000111e854 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
12 swift           0x0000000000f3748e swift::constraints::ConstraintSystem::openType(swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 78
15 swift           0x0000000001062965 swift::Expr::walk(swift::ASTWalker&) + 69
16 swift           0x0000000000f805b8 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
17 swift           0x0000000000e96753 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 371
18 swift           0x0000000000e9d092 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
19 swift           0x0000000000e9e247 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
20 swift           0x0000000000e9e45b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000eaeb16 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
28 swift           0x0000000000ed0cc2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
29 swift           0x0000000000c60529 swift::CompilerInstance::performSema() + 3289
31 swift           0x00000000007d8109 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
32 swift           0x00000000007a4148 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28330-swift-genericparamlist-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28330-swift-genericparamlist-getsubstitutionmap-3230b0.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28330-swift-genericparamlist-getsubstitutionmap.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28330-swift-genericparamlist-getsubstitutionmap.swift:13:7 - line:13: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-06-23 21:13:04 +02:00
practicalswift
6c82b0f95b [swiftc] Add 💥 case (😢 → 49, 😀 → 5090) triggered in swift::ArchetypeBuilder::PotentialArchetype::getType(…)
Add crash case with stack trace:

```
4  swift           0x0000000000fe597c swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 28
6  swift           0x000000000111e854 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
7  swift           0x000000000111eaf0 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 704
8  swift           0x0000000000fe5bfa swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 666
9  swift           0x000000000111d3ec swift::ArchetypeType::resolveNestedType(std::pair<swift::Identifier, swift::ArchetypeType::NestedType>&) const + 76
10 swift           0x000000000111d822 swift::ArchetypeType::getNestedTypes(bool) const + 66
11 swift           0x0000000000fe5e3c swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 1244
12 swift           0x0000000000feaea5 swift::ArchetypeBuilder::getArchetype(swift::GenericTypeParamDecl*) + 53
13 swift           0x0000000000ee815f swift::TypeChecker::finalizeGenericParamList(swift::ArchetypeBuilder&, swift::GenericParamList*, swift::DeclContext*) + 191
14 swift           0x0000000000ee878b swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 283
15 swift           0x0000000000ea9a49 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1833
16 swift           0x0000000001105dbb swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
17 swift           0x000000000110465b swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2555
18 swift           0x0000000000eea94b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
21 swift           0x0000000000f1bbee swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
23 swift           0x0000000000f1cb34 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
24 swift           0x0000000000f1bae0 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
27 swift           0x0000000000eaa064 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3396
32 swift           0x0000000000eaeb16 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000ed0cc2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
34 swift           0x0000000000c60529 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007d8109 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
37 swift           0x00000000007a4148 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28329-swift-archetypebuilder-potentialarchetype-gettype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28329-swift-archetypebuilder-potentialarchetype-gettype-abcd3a.o
1.	While type-checking 'n' at validation-test/compiler_crashers/28329-swift-archetypebuilder-potentialarchetype-gettype.swift:9:1
2.	While type-checking 'e' at validation-test/compiler_crashers/28329-swift-archetypebuilder-potentialarchetype-gettype.swift:9:9
3.	While resolving type A at [validation-test/compiler_crashers/28329-swift-archetypebuilder-potentialarchetype-gettype.swift:9:21 - line:9:21] RangeText="A"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-23 15:19:17 +02:00
practicalswift
532fa3dd7e [swiftc] Add 💥 case (😢 → 48, 😀 → 5090) triggered in swift::TypeBase::getDesugaredType(…)
Add crash case with stack trace:

```
4  swift           0x000000000111a170 swift::TypeBase::getDesugaredType() + 32
5  swift           0x00000000010ce6f9 swift::EnumElementDecl::computeType() + 137
7  swift           0x0000000000ea96d3 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 947
13 swift           0x0000000000eaeb16 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift           0x0000000000f1491a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
17 swift           0x0000000000f1477e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
18 swift           0x0000000000f15343 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
20 swift           0x0000000000ed0dc1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
21 swift           0x0000000000c60529 swift::CompilerInstance::performSema() + 3289
23 swift           0x00000000007d8109 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
24 swift           0x00000000007a4148 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28328-swift-typebase-getdesugaredtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28328-swift-typebase-getdesugaredtype-247a61.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28328-swift-typebase-getdesugaredtype.swift:9:6
2.	While type-checking declaration 0x6274b00 at validation-test/compiler_crashers/28328-swift-typebase-getdesugaredtype.swift:9:7
3.	While type-checking declaration 0x628a408 at validation-test/compiler_crashers/28328-swift-typebase-getdesugaredtype.swift:9:35
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-23 11:49:43 +02:00
practicalswift
07ad661bfd [swiftc] Add 💥 case (😢 → 47, 😀 → 5090) triggered in swift::Expr::walk(…)
Add crash case with stack trace:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::AnyMetatypeType, Y = swift::TypeBase]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
14 swift           0x000000000105534e swift::Expr::walk(swift::ASTWalker&) + 46
15 swift           0x0000000000f342e2 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
16 swift           0x0000000000e8fba1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
19 swift           0x0000000000f077dd swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 845
20 swift           0x0000000000f071e2 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 34
21 swift           0x0000000000f07db3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
23 swift           0x0000000000ec3831 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
24 swift           0x0000000000c59299 swift::CompilerInstance::performSema() + 3289
26 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
27 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28327-swift-expr-walk.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28327-swift-expr-walk-16422f.o
1.	While type-checking 'init' at validation-test/compiler_crashers/28327-swift-expr-walk.swift:10:33
2.	While type-checking expression at [<invalid loc> - <invalid loc>]
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-22 21:37:31 +02:00
rjmccall
8df507a903 Merge pull request #3140 from rjmccall/invalid-type-context-in-super-ref
Handle invalid contexts when computing the super type.
2016-06-22 11:45:55 -07:00
John McCall
ddf49af810 Handle invalid contexts when computing the super type. 2016-06-22 08:48:12 -07:00
practicalswift
93b9eb5637 [swiftc] Add 💥 case (😢 → 47, 😀 → 5089) triggered in swift::TypeBase::getMemberSubstitutions(…)
Add crash case with stack trace:

```
4  swift           0x0000000001112d47 swift::TypeBase::getMemberSubstitutions(swift::DeclContext const*) + 23
5  swift           0x0000000001113186 swift::TypeBase::getTypeOfMember(swift::ModuleDecl*, swift::Type, swift::DeclContext const*) + 54
7  swift           0x0000000000ea2db9 swift::TypeChecker::checkDeclCircularity(swift::NominalTypeDecl*) + 393
13 swift           0x0000000000ea1586 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift           0x0000000000f08704 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
17 swift           0x0000000000f3444c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
18 swift           0x0000000000e8fba1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
21 swift           0x0000000000f077dd swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 845
22 swift           0x0000000000f071e2 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 34
23 swift           0x0000000000f07db3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000ec3831 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c59299 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28326-swift-typebase-getmembersubstitutions.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28326-swift-typebase-getmembersubstitutions-44b09e.o
1.	While type-checking 'init' at validation-test/compiler_crashers/28326-swift-typebase-getmembersubstitutions.swift:9:9
2.	While type-checking expression at [validation-test/compiler_crashers/28326-swift-typebase-getmembersubstitutions.swift:9:16 - line:9:53] RangeText="{extension{{}protocol a{struct B{let a"
3.	While type-checking declaration 0x6103c20 at validation-test/compiler_crashers/28326-swift-typebase-getmembersubstitutions.swift:9:17
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-22 16:50:40 +02:00
practicalswift
0d0affb542 [swiftc] Add 💥 case (😢 → 46, 😀 → 5089) triggered in swift::TypeBase::getCanonicalType(…)
Add crash case with stack trace:

```
4  swift           0x0000000001108734 swift::TypeBase::getCanonicalType() + 20
8  swift           0x000000000105534e swift::Expr::walk(swift::ASTWalker&) + 46
9  swift           0x0000000000f73028 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
10 swift           0x0000000000e891c3 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 371
11 swift           0x0000000000e8fb02 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
12 swift           0x0000000000e90cb7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
13 swift           0x0000000000e90ecb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
16 swift           0x0000000000ea1586 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000f08704 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
20 swift           0x0000000000f3444c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
21 swift           0x0000000000e8fba1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
24 swift           0x0000000000f0738a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
25 swift           0x0000000000f071ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
26 swift           0x0000000000f07db3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
28 swift           0x0000000000ec3831 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
29 swift           0x0000000000c59299 swift::CompilerInstance::performSema() + 3289
31 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
32 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28325-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28325-swift-typebase-getcanonicaltype-2ce21e.o
1.	While type-checking getter for h at validation-test/compiler_crashers/28325-swift-typebase-getcanonicaltype.swift:9:17
2.	While type-checking expression at [validation-test/compiler_crashers/28325-swift-typebase-getcanonicaltype.swift:9:21 - line:9:34] RangeText="{var _=super.i"
3.	While type-checking declaration 0x6522900 at validation-test/compiler_crashers/28325-swift-typebase-getcanonicaltype.swift:9:22
4.	While type-checking expression at [validation-test/compiler_crashers/28325-swift-typebase-getcanonicaltype.swift:9:28 - line:9:34] RangeText="super.i"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-22 06:21:42 +02:00
practicalswift
f74897fdd9 [swiftc] Add 💥 case (😢 → 45, 😀 → 5089) triggered in swift::DiagnosticEngine::emitDiagnostic(…)
Add crash case with stack trace:

```
swift: /path/to/llvm/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<swift::ParenType, const swift::TypeBase *>::doit(const From *) [To = swift::ParenType, From = const swift::TypeBase *]: Assertion `Val && "isa<> used on a null pointer"' failed.
10 swift           0x00000000010c6e1b swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 2923
11 swift           0x00000000010c608f swift::DiagnosticEngine::flushActiveDiagnostic() + 319
12 swift           0x0000000000e9c6e7 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 2391
19 swift           0x0000000000ea1586 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
20 swift           0x0000000000ec3732 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
21 swift           0x0000000000c59299 swift::CompilerInstance::performSema() + 3289
23 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
24 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28324-swift-diagnosticengine-emitdiagnostic.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28324-swift-diagnosticengine-emitdiagnostic-23bd53.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28324-swift-diagnosticengine-emitdiagnostic.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-06-21 21:43:27 +02:00
practicalswift
6407a26bd6 [swiftc] Add 💥 case (😢 → 44, 😀 → 5089) triggered in swift::TypeBase::getString(…) const
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ASTPrinter.cpp:4061: void (anonymous namespace)::TypePrinter::visitArchetypeType(swift::ArchetypeType *): Assertion `GTD && GTD->isProtocolSelf()' failed.
12 swift           0x0000000001025430 swift::TypeBase::getString(swift::PrintOptions const&) const + 160
14 swift           0x00000000010c6e1b swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 2923
15 swift           0x00000000010c608f swift::DiagnosticEngine::flushActiveDiagnostic() + 319
19 swift           0x0000000000ea1586 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
22 swift           0x0000000000f08704 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
23 swift           0x0000000000f3444c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
24 swift           0x0000000000e8fba1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
27 swift           0x0000000000f0738a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
28 swift           0x0000000000f071ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
29 swift           0x0000000000f07db3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
31 swift           0x0000000000ec3831 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
32 swift           0x0000000000c59299 swift::CompilerInstance::performSema() + 3289
34 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
35 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28323-swift-typebase-getstring.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28323-swift-typebase-getstring-f72c53.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28323-swift-typebase-getstring.swift:10:37
2.	While type-checking expression at [validation-test/compiler_crashers/28323-swift-typebase-getstring.swift:10:44 - line:10:52] RangeText="{enum B:e"
3.	While type-checking 'B' at validation-test/compiler_crashers/28323-swift-typebase-getstring.swift:10:45
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-21 18:58:24 +02:00
practicalswift
23d752b2ca [swiftc] Add 💥 case (😢 → 43, 😀 → 5089) triggered in swift::TypeChecker::resolveTypeInContext(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckType.cpp:404: swift::Type swift::TypeChecker::resolveTypeInContext(swift::TypeDecl *, swift::DeclContext *, TypeResolutionOptions, bool, swift::GenericTypeResolver *, UnsatisfiedDependency *): Assertion `incomplete && "Should have found type by now"' failed.
8  swift           0x0000000000f0d7f3 swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 2851
12 swift           0x0000000000f0e65e 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           0x0000000000f0f5a4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000f0e550 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
16 swift           0x0000000000fd3e1f swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 159
17 swift           0x0000000000fac54d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
18 swift           0x0000000000e99489 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
19 swift           0x0000000000e9c22f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1183
23 swift           0x0000000000f0e65e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
25 swift           0x0000000000f0f5a4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
26 swift           0x0000000000f0e550 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
27 swift           0x0000000000ee1237 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 967
30 swift           0x0000000000ea1586 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
33 swift           0x0000000000f0738a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
34 swift           0x0000000000f071ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
35 swift           0x0000000000f07db3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
37 swift           0x0000000000ec3831 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
38 swift           0x0000000000c59299 swift::CompilerInstance::performSema() + 3289
40 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
41 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28322-swift-typechecker-resolvetypeincontext.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28322-swift-typechecker-resolvetypeincontext-f548db.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28322-swift-typechecker-resolvetypeincontext.swift:10:21
2.	While type-checking declaration 0x6499750 at validation-test/compiler_crashers/28322-swift-typechecker-resolvetypeincontext.swift:10:28
3.	While resolving type A at [validation-test/compiler_crashers/28322-swift-typechecker-resolvetypeincontext.swift:10:32 - line:10:32] RangeText="A"
4.	While resolving type A at [validation-test/compiler_crashers/28322-swift-typechecker-resolvetypeincontext.swift:10:62 - line:10:62] 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-06-21 08:02:45 +02:00
practicalswift
5f74303fc1 [swiftc] Add 💥 case (😢 → 42, 😀 → 5090) triggered in swift::constraints::ConstraintSystem::resolveOverload(…)
Add crash case with stack trace:

```
<T
<T
<T
swift: /path/to/swift/lib/Sema/ConstraintSystem.cpp:1509: void swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator *, swift::Type, swift::constraints::OverloadChoice): Assertion `!refType->hasTypeParameter() && "Cannot have a dependent type here"' failed.
8  swift           0x0000000000f2e012 swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) + 4178
9  swift           0x0000000000f972a9 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 905
10 swift           0x0000000000f29a97 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
11 swift           0x0000000000f2cf57 swift::constraints::ConstraintSystem::addOverloadSet(swift::Type, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::constraints::ConstraintLocator*, swift::constraints::OverloadChoice*) + 327
12 swift           0x0000000000f95e53 swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 563
13 swift           0x0000000000f96f64 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 68
14 swift           0x0000000000f29a97 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
20 swift           0x0000000001054a4e swift::Expr::walk(swift::ASTWalker&) + 46
21 swift           0x0000000000f72b68 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
22 swift           0x0000000000e89003 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 371
23 swift           0x0000000000e8f942 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
26 swift           0x0000000000f0761d swift::TypeChecker::typeCheckConstructorBodyUntil(swift::ConstructorDecl*, swift::SourceLoc) + 845
27 swift           0x0000000000f07022 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 34
28 swift           0x0000000000f07bf3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
30 swift           0x0000000000ec3671 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
31 swift           0x0000000000c590f9 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
34 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28321-swift-constraints-constraintsystem-resolveoverload.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28321-swift-constraints-constraintsystem-resolveoverload-7439f0.o
1.	While type-checking 'init' at validation-test/compiler_crashers/28321-swift-constraints-constraintsystem-resolveoverload.swift:10:11
2.	While type-checking expression at [<invalid loc> - <invalid loc>]
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-20 22:22:59 +02:00
practicalswift
67310e26c4 [swiftc] Add 💥 case (😢 → 42, 😀 → 5090) triggered in swift::ArchetypeBuilder::enumerateRequirements(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/GenericSignature.cpp:283: auto swift::GenericSignature::getCanonicalManglingSignature(swift::ModuleDecl &)::(anonymous class)::operator()(swift::RequirementKind, ArchetypeBuilder::PotentialArchetype *, llvm::PointerUnion<Type, ArchetypeBuilder::PotentialArchetype *>, swift::RequirementSource) const: Assertion `constraintType->isExistentialType()' failed.
10 swift           0x0000000000fdd429 swift::ArchetypeBuilder::enumerateRequirements(llvm::function_ref<void (swift::RequirementKind, swift::ArchetypeBuilder::PotentialArchetype*, llvm::PointerUnion<swift::Type, swift::ArchetypeBuilder::PotentialArchetype*>, swift::RequirementSource)>) + 185
11 swift           0x00000000010d2395 swift::GenericSignature::getCanonicalManglingSignature(swift::ModuleDecl&) const + 405
12 swift           0x0000000000f29dd5 swift::constraints::ConstraintSystem::openFunctionType(swift::AnyFunctionType*, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&, swift::DeclContext*, swift::DeclContext*, bool) + 133
13 swift           0x0000000000f2ad37 swift::constraints::ConstraintSystem::getTypeOfReference(swift::ValueDecl*, bool, bool, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*) + 1127
18 swift           0x0000000000ee7ea9 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2313
19 swift           0x0000000000ee8347 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 471
22 swift           0x0000000000ea13c6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
25 swift           0x0000000000f08544 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
26 swift           0x0000000000f3428c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
27 swift           0x0000000000e8f9e1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
28 swift           0x0000000000e90af7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
29 swift           0x0000000000e90d0b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
38 swift           0x0000000000ea13c6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
39 swift           0x0000000000ec3572 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
40 swift           0x0000000000c590f9 swift::CompilerInstance::performSema() + 3289
42 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
43 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28320-swift-archetypebuilder-enumeraterequirements.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28320-swift-archetypebuilder-enumeraterequirements-3ae5c2.o
1.	While type-checking declaration 0x50d5c40 at validation-test/compiler_crashers/28320-swift-archetypebuilder-enumeraterequirements.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28320-swift-archetypebuilder-enumeraterequirements.swift:10:37 - line:10:45] RangeText="{enum T{c"
3.	While type-checking 'T' at validation-test/compiler_crashers/28320-swift-archetypebuilder-enumeraterequirements.swift:10:38
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-20 17:00:17 +02:00
practicalswift
6f3f17ce7f [swiftc] Add 💥 case (😢 → 41, 😀 → 5090) triggered in swift::TypeChecker::checkConformance(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckProtocol.cpp:1583: diag::RequirementKind getRequirementKind(swift::ValueDecl *): Assertion `isa<SubscriptDecl>(VD) && "Unhandled requirement kind"' failed.
10 swift           0x0000000000ee7bef swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 1615
12 swift           0x0000000000ec3671 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
13 swift           0x0000000000c590f9 swift::CompilerInstance::performSema() + 3289
15 swift           0x00000000007d72b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
16 swift           0x00000000007a32c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28319-swift-typechecker-checkconformance.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28319-swift-typechecker-checkconformance-4d62c4.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-06-20 10:03:21 +02:00
Slava Pestov
b46b433336 Just-added compiler_crasher is already fixed :) 2016-06-18 17:15:25 -07:00
Slava Pestov
5b4ee41772 Parser: Diagnose if free-standing 'where' clause is attached to a non-generic declaration
Previously we would produce an empty GenericParamList, crashing Sema.
2016-06-18 17:15:25 -07:00
Slava Pestov
7814c47b71 AST: Slightly change meaning of NominalTypeDecl::getDeclaredType()
Consider this code:

struct A<T> {
  struct B {}
  struct C<U> {}
}

Previously:

- getDeclaredType() of 'A.B' would give 'A<T>.B'
- getDeclaredTypeInContext() of 'A.B' would give 'A<T>.B'

- getDeclaredType() of 'A.C' would give 'A<T>.C'
- getDeclaredTypeInContext() of 'A.C' would give 'A<T>.C<U>'

This was causing problems for nested generics. Now, with this change,

- getDeclaredType() of 'A.B' gives 'A.B' (*)
- getDeclaredTypeInContext() of 'A.B' gives 'A<T>.B'
- getDeclaredType() of 'A.C' gives 'A.C' (*)
- getDeclaredTypeInContext() of 'A.C' gives 'A<T>.C<U>'

(Differences marked with (*)).

Also, this change makes these accessors fully lazy. Previously,
only getDeclaredTypeInContext() and getDeclaredIterfaceType()
were lazy, whereas getDeclaredType() was built from validateDecl().

Fix a few spots where the return value wasn't being checked
properly.

These functions return ErrorType if a circularity was detected via
the generic parameter list, or if the extension did not resolve.
They return Type() if the extension cannot be resolved *yet*.

This is pretty subtle, and I'll need to do another pass over
callers of these functions at some point. Many of them should be
moved over to use getSelfInContext(), getSelfOfContext() and
getSelfInterfaceType() instead.

Finally, this patch consolidates logic for diagnosting invalid
nesting of types.

The parser had some code for protocols in bad places and bad things
inside protocols, and Sema had several different bail-outs for
bad things in protocols, nested generic types, and stuff nested
inside protocol extensions.

Combine all of these into a single set of checks in Sema. Note
that we no longer give up early if we find invalid nesting.
Leaving decls unvalidated and un-type-checked only leads to
further problems. Now that all the preliminary crap has been
fixed, we can go ahead and start validating these funny nested
decls, actually fixing some crashers in the process.
2016-06-18 17:15:24 -07:00
Slava Pestov
0fc095c775 Sema: Re-arrange deck chairs again
Another pre-emptive compiler_crasher regression fix.

I have an idea for consolidating some of these hacky circularity
checks in a nice way, but not now.
2016-06-18 17:05:28 -07:00
Slava Pestov
7b6736df29 Sema: When validating a nested type, only validate the parent, do not type check it
There's no need to walk the siblings of the nested type. This fixes
a class of infinite recursion issues when inheriting from nested
types.
2016-06-18 17:05:27 -07:00
Slava Pestov
528a4a547c Sema: Clean up some code duplication when validating generic type signatures
Every call to validateGenericTypeSignature() had the same
boilerplate following; move the common logic into that
function.

As one might expect, each callsite had slight variants on
the same underlying logic -- this makes them consistent.

Also, this slightly widens the scope during which
GenericTypeDecl::isValidatingGenericSignature() returns
true.

Interesting, that change introduces a diagnostic in an
existing testcase where previously there was none:

protocol P {
  associatedtype T
}

struct S<A: P where A.T == S<A>> {}

While it looks like this generic signature was built
correctly, in fact I think we weren't computing
conformances for the substitution of 'A' in 'S<A>'.

After trying small variations on the above testcase,
I quickly ran into SILGen crashes, which the diagnostic
now prevents. A few interesting cases still crash.
See test/decl/protocol/req/recursion.swift for the
gory details.
2016-06-18 17:05:27 -07:00
practicalswift
2751eae5b7 [swiftc] Add 💥 case (😢 → 57, 😀 → 5073) triggered in swift::constraints::ConstraintGraphNode::getMemberType(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/Sema/ConstraintSystem.h:1350: void swift::constraints::ConstraintSystem::addConstraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocator *, bool): Assertion `second && "Missing second type"' failed.
10 swift           0x0000000000fca006 swift::constraints::ConstraintGraphNode::getMemberType(swift::Identifier, std::function<swift::TypeVariableType* ()>) + 182
11 swift           0x0000000000fcabca swift::constraints::ConstraintGraph::getMemberType(swift::TypeVariableType*, swift::Identifier, std::function<swift::TypeVariableType* ()>) + 154
13 swift           0x0000000001110674 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
14 swift           0x0000000000f2b71b swift::constraints::ConstraintSystem::openGeneric(swift::DeclContext*, swift::DeclContext*, llvm::ArrayRef<swift::GenericTypeParamType*>, llvm::ArrayRef<swift::Requirement>, bool, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 1611
16 swift           0x0000000001110674 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
17 swift           0x0000000000f29bce swift::constraints::ConstraintSystem::openType(swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 78
20 swift           0x0000000001054835 swift::Expr::walk(swift::ASTWalker&) + 69
21 swift           0x0000000000f729d8 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
22 swift           0x0000000000e88d93 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 371
23 swift           0x0000000000e8f6d2 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
26 swift           0x0000000000f08536 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
27 swift           0x0000000000ec477d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
28 swift           0x0000000000c58f89 swift::CompilerInstance::performSema() + 3289
30 swift           0x00000000007d7139 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
31 swift           0x00000000007a3148 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28318-swift-constraints-constraintgraphnode-getmembertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28318-swift-constraints-constraintgraphnode-getmembertype-792685.o
1.	While type-checking expression at [validation-test/compiler_crashers/28318-swift-constraints-constraintgraphnode-getmembertype.swift:12:5 - line:12:5] 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-06-18 10:52:33 +02:00
practicalswift
a78f23c85e [swiftc] Remove duplicate crash cases.
Definition of uniqueness:
* 819d9a3824/test.sh (L77-L90)

Duplicates of 01793-swift-nominaltypedecl-getdeclaredtypeincontext.swift:
* 28210-swift-declcontext-getprotocolself.swift

Duplicates of 10659-swift-printingdiagnosticconsumer-handlediagnostic.timeout.swift:
* 28190-swift-conformancelookuptable-expandimpliedconformances.swift

Duplicates of 16694-swift-constraints-constraintsystem-opentype.swift:
* 28226-swift-iterativetypechecker-processinheritedprotocols.swift

Duplicates of 24394-swift-typevariabletype-implementation-getrepresentative.swift:
* 28228-swift-dependentgenerictyperesolver-resolveselfassociatedtype.swift

Duplicates of 26339-llvm-ondiskchainedhashtable-swift-modulefile-decltableinfo-find.swift:
* 01036-swift-modulefile-lookupvalue.swift
* 01879-swift-nominaltypedecl-getdeclaredtypeincontext.swift
* 01904-swift-type-transform.swift
* 01934-swift-typebase-gettypevariables.swift
* 02233-swift-constraints-constraintsystem-lookthroughimplicitlyunwrappedoptionaltype.swift
* 02242-swift-functiontype-get.swift
* 28303-swift-typechecker-checkgenericparamlist.swift
* 28304-swift-typechecker-checkgenericparamlist.swift
* 28307-swift-typechecker-resolveidentifiertype.swift
* 28308-swift-typechecker-checkgenericparamlist.swift
* 28310-swift-typechecker-checkgenericparamlist.swift
* 28311-swift-typechecker-checkgenericparamlist.swift
* 28312-swift-typechecker-checkgenericparamlist.swift
* 28313-swift-typechecker-checkgenericparamlist.swift
* 28314-swift-typechecker-checkgenericparamlist.swift

Duplicates of 26725-llvm-smallvectorimpl-swift-diagnosticargument-operator.swift:
* 28188-swift-removeoverriddendecls.timeout.swift
* 28215-swift-normalprotocolconformance-getwitness.swift
* 28255-swift-decl-dump.swift

Duplicates of 28212-swift-typechecker-resolvetypeincontext.swift:
* 28234-swift-archetypebuilder-getgenericsignature.swift

Duplicates of 28221-swift-typebase-getmembersubstitutions.swift:
* 28273-swift-archetypebuilder-potentialarchetype-gettype.swift

Duplicates of 28250-swift-typechecker-typecheckdecl.swift:
* 28238-swift-typechecker-validatedecl.swift

Duplicates of 28256-swift-typechecker-resolvetypewitness.swift:
* 28257-swift-typechecker-resolvetypewitness.swift

Duplicates of 28267-swift-typechecker-checkconformance.swift:
* 28222-swift-typechecker-checkconformance.swift

Duplicates of 28271-swift-archetypebuilder-getallarchetypes.swift:
* 25962-swift-archetypebuilder-getallarchetypes.swift

Duplicates of 28316-swift-typechecker-checkgenericparamlist.swift:
* 28305-swift-typechecker-checkgenericparamlist.swift
2016-06-17 21:16:10 +02:00
Slava Pestov
4446bc0692 Sema: Use FoldingSetNode for ProtocolType
There was a weirdness with ProtocolType::get() that was causing me grief
while trying to refactor getDeclaredType() and related code in another
patch.

Instead of caching the result like we do elsewhere, this would directly
store the new type into the ProtocolDecl. This is smelly, so let's not
do that.
2016-06-16 22:55:17 -07:00
Slava Pestov
769a5a2048 Sema: Small cleanups
Mostly NFC, but note that DeclContext::getDeclaredInterfaceType()
returns Type() for invalid extensions, whereas the older way
of going through getAsNominalTypeOrNominalTypeExtensionContext()
would crash because we'd call getDeclaredInterfaceType() on a
null decl.
2016-06-16 22:54:27 -07:00
Slava Pestov
bb6521b9b6 Sema: Improve a circularity-breaking hack
The old check was problematic because it would sometimes return
ErrorType from accessing the generic parameters of a type that was
in the process of having its generic signature validated.

Instead fix the root cause of the circularity, which was recursion
through resolveType() when resolving a type's inheritance clause.

To fix it, let's just not walk adopted protocols when looking up
the superclass of a class. Inheriting from an associated type does
not seem very useful, and will probably be hard to get right in
the general case.

I wasn't able to reduce a useful test case, but this patch prevents
compiler_crashers regressions with some other changes I'm working on.
2016-06-16 22:54:07 -07:00