Commit Graph

1442 Commits

Author SHA1 Message Date
Chris Lattner
d52ec9982c Merge pull request #879 from practicalswift/sil-023-swift-parser-parseexpridentifier
[SIL] Add test case for crash triggered in swift::Parser::parseExprIdentifier()
2016-01-05 10:12:06 -08:00
practicalswift
25ca69f82a [SIL] Add test case for crash triggered in swift::Parser::parseExprIdentifier()
Stack trace:

```
<stdin>:3:16: error: expected '>' to complete generic parameter list
enum n{func p<p{p<@convention()>
               ^
<stdin>:3:14: note: to match this opening '<'
enum n{func p<p{p<@convention()>
             ^
<stdin>:3:16: error: expected '(' in argument list of function declaration
enum n{func p<p{p<@convention()>
               ^
<stdin>:3:31: error: expected convention name identifier in 'convention' attribute
enum n{func p<p{p<@convention()>
                              ^
<stdin>:3:32: error: expected type
enum n{func p<p{p<@convention()>
                               ^
<stdin>:3:18: note: while parsing this '<' as a type parameter bracket
enum n{func p<p{p<@convention()>
                 ^
sil-opt: /path/to/swift/include/swift/Basic/SourceLoc.h:93: swift::SourceRange::SourceRange(swift::SourceLoc, swift::SourceLoc): Assertion `Start.isValid() == End.isValid() && "Start and end should either both be valid or both be invalid!"' failed.
8  sil-opt         0x0000000000a2049a swift::Parser::parseExprIdentifier() + 1722
9  sil-opt         0x0000000000a1c363 swift::Parser::parseExprPostfix(swift::Diag<>, bool) + 515
10 sil-opt         0x0000000000a1afaa swift::Parser::parseExprSequence(swift::Diag<>, bool, bool) + 170
11 sil-opt         0x0000000000a1ae9f swift::Parser::parseExprImpl(swift::Diag<>, bool) + 191
12 sil-opt         0x0000000000a51054 swift::Parser::parseExprOrStmt(swift::ASTNode&) + 420
13 sil-opt         0x0000000000a52c56 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1974
14 sil-opt         0x0000000000a573e0 swift::Parser::parseBraceItemList(swift::Diag<>) + 96
15 sil-opt         0x0000000000a11d61 swift::Parser::parseDeclFunc(swift::SourceLoc, swift::StaticSpellingKind, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 3041
16 sil-opt         0x0000000000a093ba swift::Parser::parseDecl(llvm::SmallVectorImpl<swift::Decl*>&, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>) + 3306
18 sil-opt         0x00000000009fc0a3 swift::Parser::parseList(swift::tok, swift::SourceLoc, swift::SourceLoc&, swift::tok, bool, bool, swift::Diag<>, std::function<swift::ParserStatus ()>) + 723
19 sil-opt         0x0000000000a0d28e swift::Parser::parseDeclEnum(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 1678
20 sil-opt         0x0000000000a0936b swift::Parser::parseDecl(llvm::SmallVectorImpl<swift::Decl*>&, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>) + 3227
21 sil-opt         0x0000000000a52c0e swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1902
22 sil-opt         0x00000000009fde5c swift::Parser::parseTopLevel() + 156
23 sil-opt         0x00000000009f931f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
24 sil-opt         0x00000000007398f6 swift::CompilerInstance::performSema() + 2918
25 sil-opt         0x00000000007241dc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:33
```
2016-01-05 14:58:32 +01:00
practicalswift
c60387d426 [SourceKit] Add test case for crash triggered in swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*)
Stack trace:

```
found code completion token A at offset 127
6  swift-ide-test  0x000000000095ab41 swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 193
7  swift-ide-test  0x0000000000b7a906 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150
8  swift-ide-test  0x0000000000b7a848 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
9  swift-ide-test  0x0000000000b7afe6 swift::ProtocolConformance::getTypeWitness(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 6
10 swift-ide-test  0x0000000000952c4e swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 1070
12 swift-ide-test  0x000000000097ba3e 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-ide-test  0x000000000097c944 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift-ide-test  0x000000000097b94a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
16 swift-ide-test  0x0000000000928a6a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 4890
21 swift-ide-test  0x000000000092c021 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 5969
22 swift-ide-test  0x0000000000b71fcc swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2908
23 swift-ide-test  0x000000000095293a swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 282
25 swift-ide-test  0x000000000097ba3e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
27 swift-ide-test  0x000000000097c944 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
28 swift-ide-test  0x000000000097b94a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
29 swift-ide-test  0x00000000009eb7e2 swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 146
30 swift-ide-test  0x00000000009eaa6d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
31 swift-ide-test  0x0000000000927709 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
32 swift-ide-test  0x000000000092ace1 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1041
34 swift-ide-test  0x0000000000930296 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
35 swift-ide-test  0x00000000008fca42 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
36 swift-ide-test  0x000000000076b4f2 swift::CompilerInstance::performSema() + 2946
37 swift-ide-test  0x0000000000714d83 main + 33379
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking 'a' at <INPUT-FILE>:3:3
2.	While resolving type A.e at [<INPUT-FILE>:5:13 - line:5:15] RangeText="A.e"
3.	While type-checking 'a' at <INPUT-FILE>:4:1
4.	While resolving type A.e at [<INPUT-FILE>:5:13 - line:5:15] RangeText="A.e"
```
2016-01-05 14:58:19 +01:00
practicalswift
747a6ebfe3 Add crash type annotations and Valgrind output for memory errors.
Valgrind output:

```
$ valgrind swift -frontend -c validation-test/compiler_crashers/16694-swift-constraints-constraintsystem-opentype.swift
Invalid read of size 4
   at 0x1016C00: swift::TypeBase::getDesugaredType() (in /path/to/swift/bin/swift)

$ valgrind swift -frontend -c validation-test/compiler_crashers/24394-swift-typevariabletype-implementation-getrepresentative.swift
Invalid read of size 8
   at 0x10121C4: swift::TypeBase::getCanonicalType() (in /path/to/swift/bin/swift)

$ valgrind swift -frontend -c validation-test/compiler_crashers/25458-swift-archetypetype-getnestedtype.swift
Invalid read of size 8
   at 0xE52866: (anonymous namespace)::ConformanceChecker::recordTypeWitness(swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*, swift::DeclContext*, bool, bool) (in /path/to/swift/bin/swift)

$ valgrind swift -frontend -c validation-test/compiler_crashers/27203-swift-typeloc-iserror.swift
Invalid read of size 4
   at 0xE42CD5: swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) (in /path/to/swift/bin/swift)

$ valgrind swift -frontend -c validation-test/compiler_crashers/27443-matchwitness.swift
Invalid read of size 8
   at 0xE4BAD1: checkMutating(swift::FuncDecl*, swift::FuncDecl*, swift::ValueDecl*) (in /path/to/swift/bin/swift)

$ valgrind swift -frontend -c validation-test/compiler_crashers/27754-swift-typechecker-resolvetypeincontext.swift
Invalid read of size 8
   at 0x10121C4: swift::TypeBase::getCanonicalType() (in /path/to/swift/bin/swift)

$ valgrind swift -frontend -c validation-test/compiler_crashers/28155-swift-typechecker-validategenericfuncsignature.swift
Invalid read of size 2
   at 0xF35D76: swift::FunctionType::get(swift::Type, swift::Type, swift::AnyFunctionType::ExtInfo const&) (in /path/to/swift/bin/swift)
```
2016-01-05 14:23:06 +01:00
practicalswift
53042baa41 [swiftc] Add test case for crash triggered in swift::TypeBase::getCanonicalType()
Stack trace:

```
4  swift           0x0000000001013ef4 swift::TypeBase::getCanonicalType() + 20
5  swift           0x0000000000e13176 swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5078
6  swift           0x0000000000e15649 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1833
7  swift           0x00000000010048dc swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2908
8  swift           0x00000000010032ed swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2269
9  swift           0x0000000000e3bf0b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
12 swift           0x0000000000e6593e 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           0x0000000000e66844 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000e6584a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
17 swift           0x0000000000e385dc swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 124
22 swift           0x0000000000e16671 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 5969
23 swift           0x00000000010048dc swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2908
24 swift           0x0000000000e3cbba swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 282
26 swift           0x0000000000e6593e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
28 swift           0x0000000000e66844 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
29 swift           0x0000000000e6584a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
30 swift           0x0000000000ef58d2 swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 146
31 swift           0x0000000000ef4b5d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
32 swift           0x0000000000ef4ce9 swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 889
33 swift           0x0000000000e11cb0 swift::TypeChecker::resolveInheritedProtocols(swift::ProtocolDecl*) + 64
34 swift           0x0000000000f1f191 swift::ArchetypeBuilder::addConformanceRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::ProtocolDecl*, swift::RequirementSource, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 225
37 swift           0x0000000000f20aaf swift::ArchetypeBuilder::visitInherited(llvm::ArrayRef<swift::TypeLoc>, llvm::function_ref<bool (swift::Type, swift::SourceLoc)>) + 175
38 swift           0x0000000000f1eefb swift::ArchetypeBuilder::addAbstractTypeParamRequirements(swift::AbstractTypeParamDecl*, swift::ArchetypeBuilder::PotentialArchetype*, swift::RequirementSource::Kind, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 603
39 swift           0x0000000000f1f2b7 swift::ArchetypeBuilder::addConformanceRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::ProtocolDecl*, swift::RequirementSource, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 519
42 swift           0x0000000000f20aaf swift::ArchetypeBuilder::visitInherited(llvm::ArrayRef<swift::TypeLoc>, llvm::function_ref<bool (swift::Type, swift::SourceLoc)>) + 175
43 swift           0x0000000000f1eefb swift::ArchetypeBuilder::addAbstractTypeParamRequirements(swift::AbstractTypeParamDecl*, swift::ArchetypeBuilder::PotentialArchetype*, swift::RequirementSource::Kind, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 603
44 swift           0x0000000000f1ec7c swift::ArchetypeBuilder::addGenericParameterRequirements(swift::GenericTypeParamDecl*) + 172
45 swift           0x0000000000e381c7 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::DeclContext*, bool, swift::GenericTypeResolver*) + 391
46 swift           0x0000000000e39a1f swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 143
47 swift           0x0000000000e39dd4 swift::TypeChecker::validateGenericTypeSignature(swift::NominalTypeDecl*) + 116
48 swift           0x0000000000e15400 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1248
53 swift           0x0000000000e6593e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
55 swift           0x0000000000e66844 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
56 swift           0x0000000000e6584a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
57 swift           0x0000000000ef58d2 swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 146
58 swift           0x0000000000ef4b5d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
59 swift           0x0000000000ef4ce9 swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 889
60 swift           0x0000000000e11cb0 swift::TypeChecker::resolveInheritedProtocols(swift::ProtocolDecl*) + 64
61 swift           0x0000000000f1f191 swift::ArchetypeBuilder::addConformanceRequirement(swift::ArchetypeBuilder::PotentialArchetype*, swift::ProtocolDecl*, swift::RequirementSource, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 225
64 swift           0x0000000000f20aaf swift::ArchetypeBuilder::visitInherited(llvm::ArrayRef<swift::TypeLoc>, llvm::function_ref<bool (swift::Type, swift::SourceLoc)>) + 175
65 swift           0x0000000000f1eefb swift::ArchetypeBuilder::addAbstractTypeParamRequirements(swift::AbstractTypeParamDecl*, swift::ArchetypeBuilder::PotentialArchetype*, swift::RequirementSource::Kind, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>&) + 603
66 swift           0x0000000000f1ec7c swift::ArchetypeBuilder::addGenericParameterRequirements(swift::GenericTypeParamDecl*) + 172
67 swift           0x0000000000e381c7 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::DeclContext*, bool, swift::GenericTypeResolver*) + 391
68 swift           0x0000000000e39a1f swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 143
69 swift           0x0000000000e39dd4 swift::TypeChecker::validateGenericTypeSignature(swift::NominalTypeDecl*) + 116
70 swift           0x0000000000e15400 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1248
73 swift           0x0000000000e1a816 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
74 swift           0x0000000000de6ab2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
75 swift           0x0000000000c9c702 swift::CompilerInstance::performSema() + 2946
77 swift           0x0000000000763402 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2482
78 swift           0x000000000075dfe1 main + 2705
Stack dump:
0.	Program arguments: /path/to/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28191-swift-typebase-getcanonicaltype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28191-swift-typebase-getcanonicaltype-ad7dcd.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28191-swift-typebase-getcanonicaltype.swift:7:1
2.	While resolving type A.e at [validation-test/compiler_crashers/28191-swift-typebase-getcanonicaltype.swift:7:12 - line:7:14] RangeText="A.e"
3.	While resolving type A.e at [validation-test/compiler_crashers/28191-swift-typebase-getcanonicaltype.swift:7:12 - line:7:14] RangeText="A.e"
4.	While type-checking 'A' at validation-test/compiler_crashers/28191-swift-typebase-getcanonicaltype.swift:8:1
5.	While resolving type A at [validation-test/compiler_crashers/28191-swift-typebase-getcanonicaltype.swift:10:8 - line:10:8] 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-01-04 23:32:55 +01:00
practicalswift
ef798c7a2f [SourceKit] Add test case for crash triggered in swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice)
Stack trace:

```
found code completion token A at offset 177
swift-ide-test: /path/to/swift/lib/Sema/ConstraintSystem.cpp:1466: 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-ide-test  0x00000000009a656a swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) + 4074
9  swift-ide-test  0x00000000008e0681 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 897
10 swift-ide-test  0x00000000008eae36 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 3142
11 swift-ide-test  0x00000000008e8479 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 313
12 swift-ide-test  0x00000000008e8239 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 73
13 swift-ide-test  0x000000000090f9f6 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>) + 614
14 swift-ide-test  0x0000000000915db9 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 569
19 swift-ide-test  0x00000000009c7dd8 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 104
20 swift-ide-test  0x00000000009cc68e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4046
21 swift-ide-test  0x000000000090fa25 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>) + 661
22 swift-ide-test  0x0000000000915db9 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 569
23 swift-ide-test  0x0000000000916ed0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 112
24 swift-ide-test  0x0000000000917079 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 265
26 swift-ide-test  0x000000000092b7f4 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3876
27 swift-ide-test  0x0000000000b71fcc swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2908
28 swift-ide-test  0x0000000000b709dd swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2269
29 swift-ide-test  0x0000000000951c8b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
32 swift-ide-test  0x000000000097ba3e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
34 swift-ide-test  0x000000000097c944 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
35 swift-ide-test  0x000000000097b94a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
36 swift-ide-test  0x000000000094e08b swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::DeclContext*, bool, swift::GenericTypeResolver*) + 715
37 swift-ide-test  0x000000000094f79f swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 143
38 swift-ide-test  0x000000000094fb54 swift::TypeChecker::validateGenericTypeSignature(swift::NominalTypeDecl*) + 116
39 swift-ide-test  0x000000000092aa32 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 354
43 swift-ide-test  0x0000000000930296 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
44 swift-ide-test  0x00000000008fca42 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
45 swift-ide-test  0x000000000076b4f2 swift::CompilerInstance::performSema() + 2946
46 swift-ide-test  0x0000000000714d83 main + 33379
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking 'd' at <INPUT-FILE>:3:1
2.	While resolving type g at [<INPUT-FILE>:4:32 - line:4:32] RangeText="g"
3.	While type-checking expression at [<INPUT-FILE>:4:7 - line:4:9] RangeText="b<a"
4.	While type-checking expression at [<INPUT-FILE>:4:7 - line:4:7] RangeText="b"
```
2016-01-04 21:29:52 +01:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
practicalswift
8482b5954c [swiftc] Add test case for crash triggered in swift::ConformanceLookupTable::expandImpliedConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*)
Stack trace:

```
swift: /path/to/swift/lib/AST/ConformanceLookupTable.cpp:497: void swift::ConformanceLookupTable::expandImpliedConformances(swift::NominalTypeDecl *, swift::DeclContext *, swift::LazyResolver *): Assertion `i <= 16384 && "Infinite loop due to circular protocol inheritance?"' failed.
8  swift           0x0000000001044d15 swift::ConformanceLookupTable::expandImpliedConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*) + 821
9  swift           0x0000000001042f15 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 1109
10 swift           0x000000000104655e swift::ConformanceLookupTable::getAllProtocols(swift::NominalTypeDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolDecl*>&) + 30
11 swift           0x000000000100f67f swift::NominalTypeDecl::getAllProtocols() const + 95
12 swift           0x0000000001004b49 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3529
13 swift           0x00000000010032ed swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2269
14 swift           0x0000000000e3bf0b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
15 swift           0x0000000000df81e8 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 120
17 swift           0x0000000000f6dd83 swift::Expr::walk(swift::ASTWalker&) + 19
18 swift           0x0000000000df9697 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 119
19 swift           0x0000000000dffc49 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 569
20 swift           0x0000000000e00d60 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 112
21 swift           0x0000000000e00f09 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 265
26 swift           0x0000000000e1a816 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
27 swift           0x0000000000de6ab2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
28 swift           0x0000000000c9c702 swift::CompilerInstance::performSema() + 2946
30 swift           0x0000000000763402 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2482
31 swift           0x000000000075dfe1 main + 2705
Stack dump:
0.	Program arguments: /path/to/build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28190-swift-conformancelookuptable-expandimpliedconformances.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28190-swift-conformancelookuptable-expandimpliedconformances-582f15.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28190-swift-conformancelookuptable-expandimpliedconformances.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28190-swift-conformancelookuptable-expandimpliedconformances.swift:11:7 - line:11:7] RangeText="D"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-01-04 02:55:10 +01:00
practicalswift
50baf2e53b Use consistent formatting in top of file headers. 2016-01-04 02:17:48 +01:00
Chris Lattner
ad82cbd5a9 Clone arguments with the implicit bit set when generating implicit accessors,
fixing a recently xfailed test.
2016-01-02 19:42:27 -08:00
practicalswift
66b4481fc0 [swiftc] Add test case for crash triggered in swift::ValueDecl::setType(swift::Type)
Stack trace:

```
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:7: error: expected '(' in argument list of function declaration
func f{{for b{}{String($0
      ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:16: error: expected ';' in 'for' statement
func f{{for b{}{String($0
               ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:26: error: expected ',' separator
func f{{for b{}{String($0
                         ^
                         ,
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:9:1: error: expected expression in list of expressions

^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:26: error: expected ',' separator
func f{{for b{}{String($0
                         ^
                         ,
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:9:1: error: expected '}' at end of closure

^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:16: note: to match this opening '{'
func f{{for b{}{String($0
               ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:26: error: expected ';' in 'for' statement
func f{{for b{}{String($0
                         ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:9:1: error: expected expression

^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:9:1: error: expected '{' in 'for' statement

^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:9:1: error: expected '}' at end of closure

^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:8: note: to match this opening '{'
func f{{for b{}{String($0
       ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:8: error: braced block of statements is an unused closure
func f{{for b{}{String($0
       ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:9:1: error: expected '}' at end of brace statement

^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:7: note: to match this opening '{'
func f{{for b{}{String($0
      ^
validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:13: error: use of unresolved identifier 'b'
func f{{for b{}{String($0
            ^
swift: /path/to/swift/lib/AST/Decl.cpp:1728: void swift::ValueDecl::setType(swift::Type): Assertion `!hasType() && "changing type of declaration"' failed.
8  swift           0x0000000000fc370c swift::ValueDecl::setType(swift::Type) + 92
10 swift           0x0000000000ea80d9 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 6649
11 swift           0x0000000000eaaffe swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4046
12 swift           0x0000000000df7c55 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>) + 661
13 swift           0x0000000000dfdfe9 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 569
14 swift           0x0000000000dffbc1 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 145
18 swift           0x0000000000e5f29a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
19 swift           0x0000000000e8b85c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
20 swift           0x0000000000dfe05b swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 683
23 swift           0x0000000000e5dfaa swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 362
24 swift           0x0000000000e5ddfe swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
25 swift           0x0000000000e5e9d8 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
27 swift           0x0000000000de4f7b swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1771
28 swift           0x0000000000c9ab42 swift::CompilerInstance::performSema() + 2946
30 swift           0x00000000007631e2 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2482
31 swift           0x000000000075ddc1 main + 2705
Stack dump:
0.	Program arguments: /usr/local/bin/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28189-swift-valuedecl-settype-5823eb.o
1.	While type-checking 'f' at validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:1
2.	While type-checking expression at [validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:8 - line:8:24] RangeText="{for b{}{String($"
3.	While type-checking expression at [validation-test/compiler_crashers/28189-swift-valuedecl-settype.swift:8:16 - line:8:24] RangeText="{String($"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-01-03 01:15:27 +01:00
Chris Lattner
168c8f025e My recent changes broke this test, XFAIL it until I have time to fix it (hopefully today) to unblock internal CI. 2016-01-02 15:26:51 -08:00
Jesse Rusak
63faeac77c [SR-433][Sema] Don't produce vararg tuples outside of arglists
Previously, we could produce such a tuple shuffle for non-arg
tuples, which would trigger an assert in SILGen.
2016-01-02 15:37:42 -05:00
Ling Wang
bb7119f4ae Add O(1) contains() implementation for Range with Comparable Element 2016-01-01 19:43:01 -06:00
Chris Lattner
c2f5ffa0ce Merge pull request #848 from practicalswift/sourcekit-064-swift-genericfunctiontype-get
[SourceKit] Add test case for crash triggered in swift::GenericFunctionType::get(…)
2016-01-01 13:26:01 -08:00
practicalswift
e55574aca4 [SourceKit] Add test case for crash triggered in swift::GenericFunctionType::get(swift::GenericSignature*, swift::Type, swift::Type, swift::AnyFunctionType::ExtInfo const&)
Stack trace:

```
found code completion token A at offset 144
swift-ide-test: /path/to/swift/lib/AST/ASTContext.cpp:2868: static swift::GenericFunctionType *swift::GenericFunctionType::get(swift::GenericSignature *, swift::Type, swift::Type, const swift::AnyFunctionType::ExtInfo &): Assertion `sig && "no generic signature for generic function type?!"' failed.
8  swift-ide-test  0x0000000000aa633e swift::GenericFunctionType::get(swift::GenericSignature*, swift::Type, swift::Type, swift::AnyFunctionType::ExtInfo const&) + 574
10 swift-ide-test  0x000000000092addc swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 780
15 swift-ide-test  0x0000000000b51f70 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1168
18 swift-ide-test  0x000000000085c193 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 307
19 swift-ide-test  0x000000000076b5a4 swift::CompilerInstance::performSema() + 3316
20 swift-ide-test  0x0000000000714cc3 main + 33379
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking declaration 0x4dd8ad0 at <INPUT-FILE>:2:27
```
2016-01-01 21:31:41 +01:00
practicalswift
3c1c6c8ec0 [SourceKit] Add test case for crash triggered in swift::ConformanceLookupTable::expandImpliedConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*)
Stack trace:

```
found code completion token A at offset 131
swift-ide-test: /path/to/swift/lib/AST/ConformanceLookupTable.cpp:497: void swift::ConformanceLookupTable::expandImpliedConformances(swift::NominalTypeDecl *, swift::DeclContext *, swift::LazyResolver *): Assertion `i <= 16384 && "Infinite loop due to circular protocol inheritance?"' failed.
8  swift-ide-test  0x0000000000bb3385 swift::ConformanceLookupTable::expandImpliedConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*) + 821
9  swift-ide-test  0x0000000000bb1585 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 1109
10 swift-ide-test  0x0000000000bb4504 swift::ConformanceLookupTable::lookupConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*, swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ProtocolDecl*>*, llvm::SmallVectorImpl<swift::ProtocolConformance*>*, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*) + 68
11 swift-ide-test  0x0000000000b7dfc8 swift::DeclContext::getLocalProtocols(swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*, bool) const + 136
14 swift-ide-test  0x0000000000930426 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 swift-ide-test  0x000000000097743a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
18 swift-ide-test  0x00000000009adebc swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
19 swift-ide-test  0x000000000091603b swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 683
21 swift-ide-test  0x0000000000977586 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
22 swift-ide-test  0x00000000008fccbd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1581
23 swift-ide-test  0x000000000076b432 swift::CompilerInstance::performSema() + 2946
24 swift-ide-test  0x0000000000714cc3 main + 33379
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking expression at [<INPUT-FILE>:3:7 - line:6:12] RangeText="{
protocol e:A
protocol A:A
protocol c:e"
2.	While type-checking 'c' at <INPUT-FILE>:6:1
```
2016-01-01 21:24:58 +01:00
Chris Lattner
af8d51dabe Merge pull request #822 from practicalswift/circular-protocol-inheritance
[swiftc] Add assertion: Avoid endless loop in case of circular protocol inheritance
2016-01-01 11:18:42 -08:00
Chris Lattner
c11cbfb88c Merge pull request #827 from practicalswift/circular-class-inheritance
[swiftc] Add assertion: Avoid endless loop in case of circular class inheritance
2016-01-01 11:17:45 -08:00
Chris Lattner
5ce3de8dd6 remove & dial back three old bits of syntax auto-upgrading support:
1. Array type parsing for postfix array types Int[].  We now handle this
   in the parser, but remove the AST representation of this old form.  We
   also stop making vague promises about the future by saying that "fixed
   size arrays aren't supported... yet".  Removal of this fixes a compiler
   crasher too.

2. Remove the special case support for migrating @autoclosure from types
   to parameters, which was Swift 1.0/1.1 syntax.  The world has moved or
   we don't care anymore.

3. Remove upgrade support for # arguments (nee "backtick" arguments), which
   was a Swift 1.x'ism abolished in an effort to simplify method naming
   rules.

NFC on valid code.
2015-12-31 22:29:39 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
97ef0a8b22 Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 1 compiler crash (now an assertion failure, previously a hang).
2015-12-31 15:03:53 +01:00
practicalswift
5bbd02b996 Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 1 compiler crash (now an assertion failure, previously a hang).
2015-12-31 05:23:01 +01:00
Brian Gesiak
57380faa3b [validation-test] Add line-directive doctests
`utils/line-directive` is used when building Swift (see
`cmake/modules/AddSwift.cmake`), and includes some doctests. In order
to make sure it continues to behave as intended, add its tests to
`validation-test`.
2015-12-29 00:22:47 -05:00
practicalswift
3c5d2a81c2 [SourceKit] Add test case for crash triggered in swift::GenericTypeParamType::get(unsigned int, unsigned int, swift::ASTContext const&)
Stack trace:

```
found code completion token A at offset 169
5  swift-ide-test  0x0000000000aab4e6 swift::GenericTypeParamType::get(unsigned int, unsigned int, swift::ASTContext const&) + 54
9  swift-ide-test  0x000000000095bf6a swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 282
13 swift-ide-test  0x0000000000931ad7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
16 swift-ide-test  0x000000000097937a swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 218
17 swift-ide-test  0x00000000009b157c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
18 swift-ide-test  0x000000000091721b swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 683
20 swift-ide-test  0x00000000009794c6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
21 swift-ide-test  0x0000000000900e5d swift::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 1117
34 swift-ide-test  0x0000000000ae0244 swift::Decl::walk(swift::ASTWalker&) + 20
35 swift-ide-test  0x0000000000b6aa8e swift::SourceFile::walk(swift::ASTWalker&) + 174
36 swift-ide-test  0x0000000000b69cbf swift::ModuleDecl::walk(swift::ASTWalker&) + 79
37 swift-ide-test  0x0000000000b43372 swift::DeclContext::walkContext(swift::ASTWalker&) + 146
38 swift-ide-test  0x000000000085c43a swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 138
39 swift-ide-test  0x000000000076b3e4 swift::CompilerInstance::performSema() + 3316
40 swift-ide-test  0x0000000000714b43 main + 33379
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl declaration 0x4933e30 at <INPUT-FILE>:3:1
2.	While type-checking expression at [<INPUT-FILE>:3:1 - line:5:7] RangeText="{protocol A{func b
}enum B:A{let s=b
let A{"
3.	While type-checking 'B' at <INPUT-FILE>:4:2
```
2015-12-28 17:41:20 +01:00
practicalswift
149b50d901 Fix typos in code (non-comment/documentation typos). 2015-12-28 11:42:15 +01:00
Dmitri Gribenko
a672828589 Annotate a crash test that depends on AppKit 2015-12-28 02:32:57 -08:00
Chris Lattner
487b0d1365 Merge pull request #796 from practicalswift/fix-comment-typos
Fix typos in code comments
2015-12-27 20:46:46 -08:00
practicalswift
fd70b26033 Fix typos in comments. 2015-12-28 02:15:34 +01:00
practicalswift
48c40de31e Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 2 compiler crashes (+ 1 fixed crash).
2015-12-27 19:35:50 +01:00
Brian Gesiak
ca3e11b2d6 [build-script] Determine HOST_CC in build-script
https://bugs.swift.org/browse/SR-237 calls for `build-script` and
`build-script-impl` to be merged. This commit takes another step towards
that goal by moving the logic that finds the path to the `clang` and
`clang++` executables up into Python-land.

Rather than simply moving all of the logic into `utils/build-script`,
this commit moves relevant functions into a new Python module, named
`swift_build_support`. This has several benefits:

- The logic can be tested. Whereas `build-script-impl` needed to be run
  in order to verify its behavior, the logic extracted out of it into
  `swift_build_support` can be tested in isolation.
- The logic can be split up into several files without polluting the
  `utils` directory, which now contains many different files that are
  unrelated to `build-script`.
2015-12-27 02:35:32 -05:00
Brian Gesiak
0ede0c4bcd [test] Run Python unit tests in validation tests
This repository includes several Python modules, each with unit tests.
Add a step to the validation tests to ensure these tests pass.
2015-12-27 01:57:33 -05:00
Brian Gesiak
6bba5f3432 [XCTest] Add more in-depth validation tests
The current validation tests for the stdlib XCTest only check that it
compiles, not that it works at runtime. Begin adding tests that verify
its behavior at runtime, beginning with:

- A test that Objective-C exceptions are captured and reported.
- Tests for some function overloads of `XCTAssertEqual()`.
2015-12-26 15:46:44 -05:00
Dmitri Gribenko
9d5cbc4428 Revert "Removed the ++ and -- operators" 2015-12-26 12:48:02 +01:00
Chris Lattner
fc9887fa6a Merge pull request #281 from divadretlaw/master
Removed the ++ and -- operators
2015-12-25 16:07:41 -08:00
Dmitri Gribenko
569a80c0f3 Merge pull request #774 from practicalswift/sourcekit-061-swift-constraints-solution-coercetotype
[SourceKit] Add test case for crash triggered in swift::constraints::Solution::coerceToType(…)
2015-12-25 09:21:34 -08:00
Dmitri Gribenko
b83c6d65c5 Merge pull request #775 from practicalswift/sil-021-swift-typechecker-typecheckdecl
[SIL] Add test case for crash triggered in swift::TypeChecker::typeCheckDecl(…)
2015-12-25 09:21:22 -08:00
practicalswift
bebccb4e5d [SIL] Add test case for crash triggered in swift::TypeChecker::typeCheckDecl(swift::Decl*, bool)
Stack trace:

```
<stdin>:3:26: error: expected type
protocol P{var e:<T>()->(
                         ^
<stdin>:3:26: error: expected ',' separator
protocol P{var e:<T>()->(
                         ^
                         ,
<stdin>:3:26: error: consecutive declarations on a line must be separated by ';'
protocol P{var e:<T>()->(
                         ^
                         ;
<stdin>:3:26: error: expected declaration
protocol P{var e:<T>()->(
                         ^
sil-opt: /path/to/swift/lib/AST/Decl.cpp:1782: void swift::ValueDecl::setInterfaceType(swift::Type): Assertion `(type.isNull() || !type->is<PolymorphicFunctionType>()) && "setting polymorphic function type as interface type"' failed.
13 sil-opt         0x0000000000a9b8c7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
14 sil-opt         0x0000000000a67012 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
15 sil-opt         0x0000000000738fc2 swift::CompilerInstance::performSema() + 2946
16 sil-opt         0x00000000007238ac main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'P' at <stdin>:3:1
```
2015-12-25 16:56:19 +01:00
practicalswift
eefd5cad0c [SourceKit] Add test case for crash triggered in swift::constraints::Solution::computeSubstitutions(swift::Type, swift::DeclContext*, swift::Type, swift::constraints::ConstraintLocator*, llvm::SmallVectorImpl<swift::Substitution>&) const
Stack trace:

```
found code completion token A at offset 167
swift-ide-test: /path/to/swift/lib/AST/Substitution.cpp:67: swift::Substitution::Substitution(swift::ArchetypeType *, swift::Type, ArrayRef<swift::ProtocolConformance *>): Assertion `Conformance.size() == Archetype->getConformsTo().size() && "substitution conformances don't match archetype"' failed.
9  swift-ide-test  0x00000000009ad85a swift::constraints::Solution::computeSubstitutions(swift::Type, swift::DeclContext*, swift::Type, swift::constraints::ConstraintLocator*, llvm::SmallVectorImpl<swift::Substitution>&) const + 1594
13 swift-ide-test  0x0000000000adfa45 swift::Expr::walk(swift::ASTWalker&) + 69
14 swift-ide-test  0x00000000009b1246 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 502
15 swift-ide-test  0x000000000091701b swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 683
17 swift-ide-test  0x00000000009cd2e9 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 6649
18 swift-ide-test  0x00000000009d020e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4046
19 swift-ide-test  0x0000000000910b95 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>) + 661
20 swift-ide-test  0x0000000000916fa9 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 569
21 swift-ide-test  0x00000000009180c0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 112
22 swift-ide-test  0x0000000000918269 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 265
27 swift-ide-test  0x00000000009318d7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
28 swift-ide-test  0x00000000008fd962 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
29 swift-ide-test  0x000000000076b1d2 swift::CompilerInstance::performSema() + 2946
30 swift-ide-test  0x0000000000714ad7 main + 33239
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking 'A' at <INPUT-FILE>:3:1
2.	While type-checking expression at [<INPUT-FILE>:4:7 - line:4:7] RangeText="b"
3.	While type-checking expression at [<INPUT-FILE>:4:7 - line:4:7] RangeText="b"
```
2015-12-25 16:55:25 +01:00
practicalswift
63320abe46 [SourceKit] Add test case for crash triggered in llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)
Stack trace:

```
found code completion token A at offset 224
Unhandled coercion
UNREACHABLE executed at /path/to/swift/lib/Sema/CSApply.cpp:4918!
6  swift-ide-test  0x0000000002a638ed llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
8  swift-ide-test  0x00000000009b4ac6 swift::constraints::Solution::coerceToType(swift::Expr*, swift::Type, swift::constraints::ConstraintLocator*, bool) const + 326
10 swift-ide-test  0x00000000009170c6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 854
11 swift-ide-test  0x00000000009180c0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 112
12 swift-ide-test  0x0000000000918269 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 265
14 swift-ide-test  0x000000000092cd04 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3940
19 swift-ide-test  0x0000000000b5563d swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1117
21 swift-ide-test  0x000000000085c2e3 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 307
22 swift-ide-test  0x000000000076b344 swift::CompilerInstance::performSema() + 3316
23 swift-ide-test  0x0000000000714ad7 main + 33239
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking expression at [<INPUT-FILE>:10:7 - line:10:7] RangeText="c"
```
2015-12-25 14:24:29 +01:00
practicalswift
a238922a54 [SourceKit] Add test case for crash triggered in swift::ConstructorDecl::getResultType() const
Stack trace:

```
found code completion token A at offset 127
swift-ide-test: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::AnyFunctionType, Y = swift::TypeBase]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
8  swift-ide-test  0x0000000000b40991 swift::ConstructorDecl::getResultType() const + 129
19 swift-ide-test  0x0000000000adfdf4 swift::Decl::walk(swift::ASTWalker&) + 20
20 swift-ide-test  0x0000000000b69ade swift::SourceFile::walk(swift::ASTWalker&) + 174
21 swift-ide-test  0x0000000000b68d0f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
22 swift-ide-test  0x0000000000b42e12 swift::DeclContext::walkContext(swift::ASTWalker&) + 146
23 swift-ide-test  0x000000000085c23a swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 138
24 swift-ide-test  0x000000000076b344 swift::CompilerInstance::performSema() + 3316
25 swift-ide-test  0x0000000000714ad7 main + 33239
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl declaration 0x448df20 at <INPUT-FILE>:2:14
```
2015-12-25 11:30:15 +01:00
David Walter
23772b1a21 Merge remote-tracking branch 'apple/master'
# Conflicts:
#	stdlib/private/SwiftPrivate/ShardedAtomicCounter.swift
#	stdlib/public/core/ArrayCast.swift
#	stdlib/public/core/Collection.swift
#	stdlib/public/core/ContiguousArrayBuffer.swift
#	stdlib/public/core/StringBuffer.swift
#	stdlib/public/core/StringUnicodeScalarView.swift
#	test/1_stdlib/Builtins.swift
#	test/1_stdlib/Collection.swift
#	test/1_stdlib/ErrorType.swift
#	test/1_stdlib/ErrorTypeBridging.swift
#	test/1_stdlib/ExistentialCollection.swift
#	test/1_stdlib/Float.swift
#	test/1_stdlib/Map.swift
#	test/1_stdlib/Mirror.swift
#	test/1_stdlib/Optional.swift
#	test/DebugInfo/arg-debug_value.swift
#	test/DebugInfo/closure.swift
#	test/DebugInfo/for.swift
#	test/DebugInfo/return.swift
#	test/Interpreter/availability_weak_linking.swift
#	test/Interpreter/break_continue.swift
#	test/SILGen/sil_locations.swift
#	test/SILGen/statements.swift
#	test/SILGen/unreachable_code.swift
#	test/SILPasses/definite_init_diagnostics.swift
#	test/SILPasses/return.swift
#	test/SILPasses/switch.swift
#	test/SILPasses/unreachable_code.swift
2015-12-24 13:18:29 +01:00
Dmitri Gribenko
9b15d03b73 StdlibUnittest: don't pass the name of the executable on the command line
Also, add a test for the command line of the child process.
2015-12-24 02:27:57 -08:00
Chris Lattner
5d6c20b0b6 fix 058-swift-constraints-constraintsystem-diagnosefailureforexpr.swift
CSDiag's wasn't considering the case when an operator was invalid and had ErrorType.
2015-12-23 17:28:08 -08:00
Dmitri Gribenko
b1fdf56f5c stdlib: mark _preprocessingPass with @noescape 2015-12-23 14:56:15 -08:00
Dmitri Gribenko
88002e3c16 Merge pull request #748 from practicalswift/sil-020-swift-moduledecl-lookupconformance
[SIL] Add test case for crash triggered in swift::ModuleDecl::lookupConformance(…)
2015-12-23 14:19:00 -08:00
Dmitri Gribenko
f0021929cc Merge pull request #735 from alexwlchan/python/file-open
Tidy up Python file handlers
2015-12-23 11:49:08 -08:00
Dmitri Gribenko
3877d04a73 Merge pull request #731 from ken0nek/add-spaces-before-and-after-arrow
Add spaces before and after closure arrow
2015-12-23 10:53:22 -08:00
Max Moiseev
200be71583 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-23 10:28:04 -08:00
Dmitri Gribenko
9ec295932c Merge pull request #747 from practicalswift/sourcekit-059-swift-iterativetypechecker-processinheritedprotocols
[SourceKit] Add test case for crash triggered in swift::IterativeTypeChecker::processInheritedProtocols(…)
2015-12-23 09:06:01 -08:00