Commit Graph

434 Commits

Author SHA1 Message Date
practicalswift
bae368c695 [SourceKit] Add test case for crash triggered in swift::GenericSignature::getArchetypeBuilder(swift::ModuleDecl&)
Stack trace:

```
found code completion token A at offset 135
3  swift-ide-test  0x0000000000c91863 swift::GenericSignature::getArchetypeBuilder(swift::ModuleDecl&) + 19
4  swift-ide-test  0x0000000000c925a3 swift::GenericSignature::getConformsTo(swift::Type, swift::ModuleDecl&) + 83
6  swift-ide-test  0x0000000000cd092d swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 45
12 swift-ide-test  0x0000000000c94281 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 529
17 swift-ide-test  0x0000000000c54904 swift::Decl::walk(swift::ASTWalker&) + 20
18 swift-ide-test  0x0000000000ca8fae swift::SourceFile::walk(swift::ASTWalker&) + 174
19 swift-ide-test  0x0000000000ca82bf swift::ModuleDecl::walk(swift::ASTWalker&) + 95
20 swift-ide-test  0x0000000000c7ee24 swift::DeclContext::walkContext(swift::ASTWalker&) + 180
21 swift-ide-test  0x0000000000988058 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
22 swift-ide-test  0x0000000000838541 swift::CompilerInstance::performSema() + 3697
23 swift-ide-test  0x00000000007d8d91 main + 42417
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl 'b' at <INPUT-FILE>:3:1
```
2016-10-06 20:15:17 +02:00
practicalswift
de4c31eb64 [SourceKit] Add test case for crash triggered in swift::DeclContext::getResilienceExpansion() const
Stack trace:

```
found code completion token A at offset 133
swift-ide-test: /path/to/swift/include/swift/AST/Decl.h:2050: swift::Accessibility swift::ValueDecl::getFormalAccess(const swift::DeclContext *) const: Assertion `hasAccessibility() && "accessibility not computed yet"' failed.
8  swift-ide-test  0x0000000000c7ea8f swift::DeclContext::getResilienceExpansion() const + 111
9  swift-ide-test  0x0000000000c6f892 swift::ValueDecl::getAccessSemanticsFromContext(swift::DeclContext const*) const + 18
10 swift-ide-test  0x0000000000a5dc64 swift::TypeChecker::buildRefExpr(llvm::ArrayRef<swift::ValueDecl*>, swift::DeclContext*, swift::DeclNameLoc, bool, bool, swift::FunctionRefKind) + 116
11 swift-ide-test  0x0000000000a0e7a2 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3346
12 swift-ide-test  0x0000000000a129f5 swift::TypeChecker::typeCheckCompletionSequence(swift::Expr*&, swift::DeclContext*) + 229
13 swift-ide-test  0x0000000000a4e041 swift::typeCheckCompletionSequence(swift::DeclContext*, swift::Expr*&) + 65
17 swift-ide-test  0x0000000000c54904 swift::Decl::walk(swift::ASTWalker&) + 20
18 swift-ide-test  0x0000000000ca8fae swift::SourceFile::walk(swift::ASTWalker&) + 174
19 swift-ide-test  0x0000000000ca82bf swift::ModuleDecl::walk(swift::ASTWalker&) + 95
20 swift-ide-test  0x0000000000c7ee24 swift::DeclContext::walkContext(swift::ASTWalker&) + 180
21 swift-ide-test  0x0000000000988058 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
22 swift-ide-test  0x0000000000838541 swift::CompilerInstance::performSema() + 3697
23 swift-ide-test  0x00000000007d8d91 main + 42417
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl 'init' at <INPUT-FILE>:3:1
2.	While type-checking expression at [<INPUT-FILE>:3:6 - line:3:7] RangeText="()"
```
2016-10-06 16:36:37 +02:00
Slava Pestov
581c99ba61 Resolve some crashers 2016-10-03 00:39:50 -04:00
practicalswift
08ba23eca3 [SourceKit] Add test case for crash triggered in swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>)
Stack trace:

```
found code completion token A at offset 176
swift-ide-test: /path/to/swift/lib/Sema/TypeCheckNameLookup.cpp:307: swift::LookupTypeResult swift::TypeChecker::lookupMemberType(swift::DeclContext *, swift::Type, swift::Identifier, NameLookupOptions): Assertion `!type->isTypeParameter()' failed.
8  swift-ide-test  0x00000000009d39d4 swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 1556
9  swift-ide-test  0x0000000000954c6d swift::constraints::ConstraintSystem::performMemberLookup(swift::constraints::ConstraintKind, swift::DeclName, swift::Type, swift::FunctionRefKind, swift::constraints::ConstraintLocator*, bool) + 2413
10 swift-ide-test  0x0000000000956a5b swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 491
11 swift-ide-test  0x0000000000957bc5 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 69
12 swift-ide-test  0x000000000095bc9b swift::constraints::ConstraintSystem::simplify(bool) + 107
13 swift-ide-test  0x000000000095d131 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 49
14 swift-ide-test  0x00000000009648c0 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 18416
15 swift-ide-test  0x000000000095d243 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 323
16 swift-ide-test  0x000000000095d028 swift::constraints::ConstraintSystem::Candidate::solve() + 696
17 swift-ide-test  0x000000000095f838 swift::constraints::ConstraintSystem::shrink(swift::Expr*) + 648
18 swift-ide-test  0x000000000095fa21 swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 65
19 swift-ide-test  0x0000000000979d23 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 403
20 swift-ide-test  0x000000000097d445 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
22 swift-ide-test  0x00000000009fe7b1 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 113
23 swift-ide-test  0x00000000009fe6fe swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
24 swift-ide-test  0x00000000009bb5df swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 655
26 swift-ide-test  0x00000000008f2a71 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 305
27 swift-ide-test  0x00000000007abd9d swift::CompilerInstance::performSema() + 3597
28 swift-ide-test  0x000000000074d981 main + 36401
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>:4:22 - line:4:28] RangeText="[{func"
```
2016-09-30 21:36:33 +02:00
practicalswift
d8438dfdcb [SourceKit] Add test case for crash triggered in swift::ValueDecl::getFormalAccessScope(swift::DeclContext const*) const
Stack trace:

```
found code completion token A at offset 132
4  swift-ide-test  0x0000000000c2fc3b swift::ValueDecl::getFormalAccessScope(swift::DeclContext const*) const + 11
6  swift-ide-test  0x00000000009dd067 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2103
8  swift-ide-test  0x00000000009b9271 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
9  swift-ide-test  0x00000000007abc69 swift::CompilerInstance::performSema() + 3289
10 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
```
2016-09-25 17:07:21 +02:00
practicalswift
34c173cb35 [SourceKit] Add test case for crash triggered in swift::GenericEnvironment::GenericEnvironment(llvm::DenseMap<swift::TypeBase*, swift::Type, llvm::DenseMapInfo<swift::TypeBase*>, llvm::detail::DenseMapPair<swift::TypeBase*, swift::Type> >)
Stack trace:

```
found code completion token A at offset 160
swift-ide-test: /path/to/swift/lib/AST/GenericEnvironment.cpp:40: swift::GenericEnvironment::GenericEnvironment(TypeSubstitutionMap): Assertion `result.second && "duplicate generic parameters in environment"' failed.
8  swift-ide-test  0x0000000000c4d578 swift::GenericEnvironment::GenericEnvironment(llvm::DenseMap<swift::TypeBase*, swift::Type, llvm::DenseMapInfo<swift::TypeBase*>, llvm::detail::DenseMapPair<swift::TypeBase*, swift::Type> >) + 728
9  swift-ide-test  0x0000000000b6eea9 swift::GenericEnvironment::get(swift::ASTContext&, llvm::DenseMap<swift::TypeBase*, swift::Type, llvm::DenseMapInfo<swift::TypeBase*>, llvm::detail::DenseMapPair<swift::TypeBase*, swift::Type> >) + 57
10 swift-ide-test  0x0000000000b57c16 swift::ArchetypeBuilder::getGenericEnvironment(llvm::ArrayRef<swift::GenericTypeParamType*>) + 326
11 swift-ide-test  0x00000000009cfdf6 swift::TypeChecker::finalizeGenericParamList(swift::ArchetypeBuilder&, swift::GenericParamList*, swift::GenericSignature*, swift::DeclContext*) + 150
14 swift-ide-test  0x000000000098d101 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 945
17 swift-ide-test  0x0000000000c50ac0 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 256
22 swift-ide-test  0x0000000000bcce84 swift::Decl::walk(swift::ASTWalker&) + 20
23 swift-ide-test  0x0000000000c65a5e swift::SourceFile::walk(swift::ASTWalker&) + 174
24 swift-ide-test  0x0000000000c64b7f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
25 swift-ide-test  0x0000000000c3b90b swift::DeclContext::walkContext(swift::ASTWalker&) + 187
26 swift-ide-test  0x00000000008f29c8 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
27 swift-ide-test  0x00000000007abd9d swift::CompilerInstance::performSema() + 3597
28 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl getter for a at <INPUT-FILE>:3:6
2.	While type-checking 'a' at <INPUT-FILE>:3:23
```
2016-09-17 07:38:07 +02:00
practicalswift
23494931bf [SourceKit] Add test case for crash triggered in swift::TypeChecker::computeDefaultAccessibility(swift::ExtensionDecl*)
Stack trace:

```
found code completion token A at offset 176
swift-ide-test: /path/to/swift/include/swift/AST/Decl.h:1572: void swift::ExtensionDecl::setDefaultAndMaxAccessibility(swift::Accessibility, swift::Accessibility): Assertion `!hasDefaultAccessibility() && "default accessibility already set"' failed.
9  swift-ide-test  0x000000000098ef3b swift::TypeChecker::computeDefaultAccessibility(swift::ExtensionDecl*) + 843
10 swift-ide-test  0x000000000098f4a0 swift::TypeChecker::computeAccessibility(swift::ValueDecl*) + 688
11 swift-ide-test  0x000000000098f81c swift::TypeChecker::validateAccessibility(swift::ValueDecl*) + 76
12 swift-ide-test  0x000000000098cd92 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 66
16 swift-ide-test  0x00000000009936e6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 swift-ide-test  0x00000000009b9172 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
18 swift-ide-test  0x00000000007abc69 swift::CompilerInstance::performSema() + 3289
19 swift-ide-test  0x000000000074d981 main + 36401
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
```
2016-09-16 16:28:23 +02:00
practicalswift
1c21516e86 [SourceKit] Add test case for crash triggered in swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest)
Stack trace:

```
found code completion token A at offset 126
swift-ide-test: /path/to/swift/lib/Sema/IterativeTypeChecker.cpp:103: void swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest): Assertion `isSatisfied(request)' failed.
9  swift-ide-test  0x0000000000a859d9 swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 889
12 swift-ide-test  0x000000000098da92 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
15 swift-ide-test  0x00000000009936e6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift-ide-test  0x00000000009b9172 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
17 swift-ide-test  0x00000000007abc69 swift::CompilerInstance::performSema() + 3289
18 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking 'B' at <INPUT-FILE>:4:1
2.	While type-checking 'B' at <INPUT-FILE>:4:1
```
2016-09-15 21:02:28 +02:00
practicalswift
fcd5fd3a23 [SourceKit] Add test case for crash triggered in swift::NameAliasType::getSinglyDesugaredType()
Stack trace:

```
found code completion token A at offset 126
swift-ide-test: /path/to/swift/include/swift/AST/Decl.h:2387: swift::Type swift::TypeAliasDecl::getUnderlyingType() const: Assertion `!UnderlyingTy.getType().isNull() && "getting invalid underlying type"' failed.
8  swift-ide-test  0x0000000000c890f2 swift::NameAliasType::getSinglyDesugaredType() + 146
9  swift-ide-test  0x0000000000c84baa swift::TypeBase::getCanonicalType() + 474
10 swift-ide-test  0x0000000000c84ca5 swift::TypeBase::getCanonicalType() + 725
11 swift-ide-test  0x0000000000c6e8a4 swift::removeShadowedDecls(llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::ModuleDecl const*, swift::LazyResolver*) + 324
16 swift-ide-test  0x0000000000c50e64 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1188
17 swift-ide-test  0x00000000009d3c62 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
18 swift-ide-test  0x00000000009793ea swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 4058
20 swift-ide-test  0x0000000000bcca3b swift::Expr::walk(swift::ASTWalker&) + 27
21 swift-ide-test  0x0000000000979c70 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
22 swift-ide-test  0x000000000097d445 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
23 swift-ide-test  0x00000000009817d0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
24 swift-ide-test  0x00000000009819c5 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 229
26 swift-ide-test  0x000000000098dc61 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3857
28 swift-ide-test  0x000000000098da92 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
29 swift-ide-test  0x0000000000c72a0b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
30 swift-ide-test  0x0000000000c7122e swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 4990
31 swift-ide-test  0x00000000009d2763 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 99
34 swift-ide-test  0x0000000000a06042 swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 162
36 swift-ide-test  0x0000000000a070e4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
37 swift-ide-test  0x0000000000a05873 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 195
40 swift-ide-test  0x000000000098da92 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
44 swift-ide-test  0x00000000009936e6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
45 swift-ide-test  0x00000000009b9172 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
46 swift-ide-test  0x00000000007abc69 swift::CompilerInstance::performSema() + 3289
47 swift-ide-test  0x000000000074d981 main + 36401
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>:6:1
2.	While type-checking 'e' at <INPUT-FILE>:9:1
3.	While resolving type f at [<INPUT-FILE>:9:13 - line:9:13] RangeText="f"
4.	While type-checking 'f' at <INPUT-FILE>:10:1
5.	While type-checking expression at [<INPUT-FILE>:8:7 - line:8:7] RangeText="F"
```
2016-09-14 14:30:04 +02:00
practicalswift
af345fae31 [SourceKit] Add test case for crash triggered in swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int)
Stack trace:

```
found code completion token A at offset 158
swift-ide-test: /path/to/swift/lib/AST/LookupVisibleDecls.cpp:566: void lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer &, const swift::DeclContext *, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver *, VisitedSet &): Assertion `BaseTy.getPointer() != CurClass->getSuperclass().getPointer() && "type is its own superclass"' failed.
10 swift-ide-test  0x00000000009d3c4b swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 267
12 swift-ide-test  0x0000000000a54d43 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 2899
13 swift-ide-test  0x0000000000a5aade swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
14 swift-ide-test  0x0000000000979d67 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 471
15 swift-ide-test  0x000000000097d445 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
16 swift-ide-test  0x00000000009817d0 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
17 swift-ide-test  0x00000000009819c5 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 229
22 swift-ide-test  0x00000000009936e6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
25 swift-ide-test  0x00000000009fe89a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
26 swift-ide-test  0x00000000009fe6fe swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
27 swift-ide-test  0x00000000009bb5df swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 655
33 swift-ide-test  0x0000000000bcce84 swift::Decl::walk(swift::ASTWalker&) + 20
34 swift-ide-test  0x0000000000c65a5e swift::SourceFile::walk(swift::ASTWalker&) + 174
35 swift-ide-test  0x0000000000c64b7f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
36 swift-ide-test  0x0000000000c3b90b swift::DeclContext::walkContext(swift::ASTWalker&) + 187
37 swift-ide-test  0x00000000008f29c8 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
38 swift-ide-test  0x00000000007abd9d swift::CompilerInstance::performSema() + 3597
39 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl getter for a at <INPUT-FILE>:3:6
2.	While type-checking 'S' at <INPUT-FILE>:3:7
3.	While type-checking expression at [<INPUT-FILE>:3:20 - line:3:22] RangeText="A.a"
```
2016-09-12 14:47:34 +02:00
practicalswift
597ee2b770 [SourceKit] Add test case for crash triggered in swift::DeclContext::getParentModule() const
Stack trace:

```
found code completion token A at offset 166
4  swift-ide-test  0x0000000000c3a451 swift::DeclContext::getParentModule() const + 1
5  swift-ide-test  0x0000000000b57613 swift::ArchetypeBuilder::mapTypeOutOfContext(swift::DeclContext const*, swift::Type) + 19
6  swift-ide-test  0x0000000000c5818c swift::Mangle::Mangler::mangleType(swift::Type, unsigned int) + 4188
7  swift-ide-test  0x0000000000c5a6fd swift::Mangle::Mangler::mangleBoundGenericType(swift::Type) + 269
8  swift-ide-test  0x0000000000c59432 swift::Mangle::Mangler::mangleDeclType(swift::ValueDecl const*, unsigned int) + 242
9  swift-ide-test  0x0000000000c565fd swift::Mangle::Mangler::mangleNominalType(swift::NominalTypeDecl const*) + 157
10 swift-ide-test  0x0000000000c990d9 swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 1113
12 swift-ide-test  0x00000000007b45d8 copyAssociatedUSRs(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&, swift::Decl const*) + 104
13 swift-ide-test  0x00000000007b543e swift::ide::CodeCompletionResultBuilder::takeResult() + 1646
17 swift-ide-test  0x0000000000c50bf2 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 562
24 swift-ide-test  0x0000000000bcce84 swift::Decl::walk(swift::ASTWalker&) + 20
25 swift-ide-test  0x0000000000c65a5e swift::SourceFile::walk(swift::ASTWalker&) + 174
26 swift-ide-test  0x0000000000c64b7f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
27 swift-ide-test  0x0000000000c3b90b swift::DeclContext::walkContext(swift::ASTWalker&) + 187
28 swift-ide-test  0x00000000008f29c8 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
29 swift-ide-test  0x00000000007abd9d swift::CompilerInstance::performSema() + 3597
30 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl 'c' at <INPUT-FILE>:3:1
```
2016-09-12 13:19:47 +02:00
swift-ci
ef75e47632 Merge pull request #4716 from practicalswift/sourcekit-086-swift-printoptions-setarchetypeanddynamicselftransform 2016-09-12 04:12:06 -07:00
practicalswift
85fe0ade35 [SourceKit] Add test case for crash triggered in swift::PrintOptions::setArchetypeAndDynamicSelfTransform(swift::Type, swift::DeclContext*)
Stack trace:

```
found code completion token A at offset 144
swift-ide-test: /path/to/swift/lib/AST/ASTPrinter.cpp:69: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type): Assertion `ParamDecls.size() == Args.size()' failed.
9  swift-ide-test  0x0000000000b982b2 swift::PrintOptions::setArchetypeAndDynamicSelfTransform(swift::Type, swift::DeclContext*) + 130
13 swift-ide-test  0x00000000009dd067 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2103
14 swift-ide-test  0x00000000009dd577 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 487
19 swift-ide-test  0x00000000009936e6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
22 swift-ide-test  0x00000000009ffab4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
23 swift-ide-test  0x0000000000a37d7c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
24 swift-ide-test  0x000000000097d4f6 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1126
26 swift-ide-test  0x00000000009ffbf6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
27 swift-ide-test  0x00000000009b91dd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
28 swift-ide-test  0x00000000007abc69 swift::CompilerInstance::performSema() + 3289
29 swift-ide-test  0x000000000074d981 main + 36401
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:1 - line:3:30] RangeText="{protocol b{func aenum S<T>:b"
2.	While type-checking 'b' at <INPUT-FILE>:3:2
```
2016-09-12 11:27:06 +02:00
practicalswift
f9429003a8 [SourceKit] Add test case for crash triggered in swift::PersistentParserState::delayTopLevel(swift::TopLevelCodeDecl*, swift::SourceRange, swift::SourceLoc)
Stack trace:

```
found code completion token A at offset 151
swift-ide-test: /path/to/swift/lib/Parse/PersistentParserState.cpp:76: void swift::PersistentParserState::delayDecl(swift::PersistentParserState::DelayedDeclKind, unsigned int, swift::DeclContext *, swift::SourceRange, swift::SourceLoc): Assertion `!CodeCompletionDelayedDeclState.get() && "only one decl can be delayed for code completion"' failed.
9  swift-ide-test  0x0000000000937ec5 swift::PersistentParserState::delayTopLevel(swift::TopLevelCodeDecl*, swift::SourceRange, swift::SourceLoc) + 37
10 swift-ide-test  0x000000000092626f swift::Parser::consumeTopLevelDecl(swift::Parser::ParserPosition, swift::TopLevelCodeDecl*) + 143
11 swift-ide-test  0x0000000000926e21 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 2929
12 swift-ide-test  0x00000000008bd01c swift::Parser::parseTopLevel() + 156
13 swift-ide-test  0x00000000008f28d0 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
14 swift-ide-test  0x00000000007abc46 swift::CompilerInstance::performSema() + 3254
15 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	With parser at source location: <INPUT-FILE>:4:3
```
2016-09-12 09:34:22 +02:00
practicalswift
3c1a63a69f [SourceKit] Add test case for crash triggered in swift::Parser::consumeDecl(swift::Parser::ParserPosition, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, bool)
Stack trace:

```
found code completion token A at offset 140
swift-ide-test: /path/to/swift/lib/Parse/PersistentParserState.cpp:76: void swift::PersistentParserState::delayDecl(swift::PersistentParserState::DelayedDeclKind, unsigned int, swift::DeclContext *, swift::SourceRange, swift::SourceLoc): Assertion `!CodeCompletionDelayedDeclState.get() && "only one decl can be delayed for code completion"' failed.
9  swift-ide-test  0x00000000008c778f swift::Parser::consumeDecl(swift::Parser::ParserPosition, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, bool) + 175
10 swift-ide-test  0x00000000008c8ef2 swift::Parser::parseDecl(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, llvm::function_ref<void (swift::Decl*)>) + 4674
11 swift-ide-test  0x00000000009265f9 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 841
12 swift-ide-test  0x00000000008e7378 swift::Parser::parseExprClosure() + 936
13 swift-ide-test  0x00000000008e7e62 swift::Parser::parseTrailingClosure(swift::SourceRange) + 34
14 swift-ide-test  0x00000000008e0b8b swift::Parser::parseExprPostfix(swift::Diag<>, bool) + 5499
15 swift-ide-test  0x00000000008dde2e swift::Parser::parseExprSequence(swift::Diag<>, bool, bool) + 174
16 swift-ide-test  0x00000000008ddd02 swift::Parser::parseExprImpl(swift::Diag<>, bool) + 146
18 swift-ide-test  0x00000000008f5d99 swift::Parser::parseList(swift::tok, swift::SourceLoc, swift::SourceLoc&, swift::tok, bool, bool, swift::Diag<>, std::function<swift::ParserStatus ()>) + 393
19 swift-ide-test  0x00000000008e4ddb swift::Parser::parseExprList(swift::tok, swift::tok, bool, bool, swift::SourceLoc&, llvm::SmallVectorImpl<swift::Expr*>&, llvm::SmallVectorImpl<swift::Identifier>&, llvm::SmallVectorImpl<swift::SourceLoc>&, swift::SourceLoc&, swift::Expr*&) + 267
20 swift-ide-test  0x00000000008e7fe2 swift::Parser::parseExprList(swift::tok, swift::tok) + 226
21 swift-ide-test  0x00000000008e00f2 swift::Parser::parseExprPostfix(swift::Diag<>, bool) + 2786
22 swift-ide-test  0x00000000008dde2e swift::Parser::parseExprSequence(swift::Diag<>, bool, bool) + 174
23 swift-ide-test  0x00000000008ddd02 swift::Parser::parseExprImpl(swift::Diag<>, bool) + 146
24 swift-ide-test  0x0000000000924cf6 swift::Parser::parseExprOrStmt(swift::ASTNode&) + 422
25 swift-ide-test  0x00000000009269fb swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1867
26 swift-ide-test  0x00000000008bd01c swift::Parser::parseTopLevel() + 156
27 swift-ide-test  0x00000000008f28d0 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
28 swift-ide-test  0x00000000007abc46 swift::CompilerInstance::performSema() + 3254
29 swift-ide-test  0x000000000074d981 main + 36401
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	With parser at source location: <INPUT-FILE>:3:16
```
2016-09-11 11:22:10 +02:00
Slava Pestov
f19192d498 ArchetypeBuilder: Sort requirements in enumerateRequirements()
Move the sorting algorithm from construction of the canonical mangling
signature to requirement enumeration.

This also changes how same-type constraints pick representatives, using
the more canonical total order.
2016-09-06 11:51:13 -07:00
Ben Langmuir
2855634999 [codecomplete] Check for ErrorType before asking for CD->getResultType()
Fixes a crash where we try to cast ErrorType to a function type to get
the result.

rdar://problem/27763826
2016-08-23 13:14:56 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Slava Pestov
47898c5962 These tests no longer require asserts to be enabled
Review feedback from @jrose-apple.
2016-08-05 16:26:01 -07:00
Slava Pestov
522f4e4572 AST: Replace recently-added IsInOut bit with simpler check, NFC
Thanks to @lattner for the suggestion.
2016-08-05 14:27:16 -07:00
Andrew Trick
a18d490d6a Migrate from UnsafePointer<Void> to UnsafeRawPointer. (#3773)
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.

As proposed in SE-0107: UnsafeRawPointer.

`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.

Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.

* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.

This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.

* Fix a bunch of test cases for Void->Raw migration.

* qsort takes IUO values

* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.

* Parse #dsohandle as UnsafeMutableRawPointer

* Update a bunch of test cases for Void->Raw migration.

* Trivial fix for the SceneKit test case.

* Add an UnsafeRawPointer self initializer.

This is unfortunately necessary for assignment between types imported from C.

* Tiny simplification of the initializer.
2016-07-26 14:21:15 -07:00
David Farler
7bfaeb57f1 [SE-0081] Warn on deprecated where clause inside angle brackets
and provide a fix-it to move it to the new location as referenced
in SE-0081.

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

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

While investigating what I thought was a new crash due to this new
diagnostic, I discovered two sources of quite a few compiler crashers
related to unterminated generic parameter lists, where the right
angle bracket source location was getting unconditionally set to
the current token, even though it wasn't actually a '>'.
2016-07-26 01:41:10 -07:00
swift-ci
765ddb0f87 Merge pull request #3713 from practicalswift/sourcekit-082-swift-typebase-gatherallsubstitutions 2016-07-23 11:26:02 -07:00
practicalswift
f9b09a8590 [SourceKit] Add test case for crash triggered in swift::DeclContext::getGenericParamsOfContext() const
Stack trace:

```
found code completion token A at offset 157
4  swift-ide-test  0x0000000000c29727 swift::DeclContext::getGenericParamsOfContext() const + 23
5  swift-ide-test  0x0000000000b428f0 swift::ArchetypeBuilder::mapTypeOutOfContext(swift::DeclContext const*, swift::Type) + 16
6  swift-ide-test  0x0000000000c46e6c swift::Mangle::Mangler::mangleType(swift::Type, unsigned int) + 4156
7  swift-ide-test  0x0000000000c48142 swift::Mangle::Mangler::mangleDeclType(swift::ValueDecl const*, unsigned int) + 242
8  swift-ide-test  0x0000000000c4528d swift::Mangle::Mangler::mangleNominalType(swift::NominalTypeDecl const*) + 157
9  swift-ide-test  0x0000000000c862c8 swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 840
11 swift-ide-test  0x00000000007af6d8 copyAssociatedUSRs(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&, swift::Decl const*) + 104
12 swift-ide-test  0x00000000007b055c swift::ide::CodeCompletionResultBuilder::takeResult() + 1676
16 swift-ide-test  0x0000000000c3f912 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 562
23 swift-ide-test  0x0000000000bbbd34 swift::Decl::walk(swift::ASTWalker&) + 20
24 swift-ide-test  0x0000000000c5449e swift::SourceFile::walk(swift::ASTWalker&) + 174
25 swift-ide-test  0x0000000000c535df swift::ModuleDecl::walk(swift::ASTWalker&) + 79
26 swift-ide-test  0x0000000000c2a6db swift::DeclContext::walkContext(swift::ASTWalker&) + 187
27 swift-ide-test  0x00000000008eeb68 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
28 swift-ide-test  0x00000000007a6efd swift::CompilerInstance::performSema() + 3597
29 swift-ide-test  0x000000000074a181 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl 'B' at <INPUT-FILE>:3:1
```
2016-07-23 18:25:06 +02:00
practicalswift
dc12333b36 [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 162
Not a nominal or bound generic type
UNREACHABLE executed at /path/to/swift/lib/AST/Module.cpp:642!
6  swift-ide-test  0x0000000002eca1cd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
7  swift-ide-test  0x0000000000c4fbae swift::TypeBase::gatherAllSubstitutions(swift::ModuleDecl*, swift::LazyResolver*, swift::DeclContext*) + 4398
8  swift-ide-test  0x0000000000c76ec1 swift::TypeBase::getSuperclass(swift::LazyResolver*) + 193
17 swift-ide-test  0x0000000000bbbd34 swift::Decl::walk(swift::ASTWalker&) + 20
18 swift-ide-test  0x0000000000c5449e swift::SourceFile::walk(swift::ASTWalker&) + 174
19 swift-ide-test  0x0000000000c535df swift::ModuleDecl::walk(swift::ASTWalker&) + 79
20 swift-ide-test  0x0000000000c2a6db swift::DeclContext::walkContext(swift::ASTWalker&) + 187
21 swift-ide-test  0x00000000008eeb68 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
22 swift-ide-test  0x00000000007a6efd swift::CompilerInstance::performSema() + 3597
23 swift-ide-test  0x000000000074a181 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl 'B' at <INPUT-FILE>:3:1
```
2016-07-23 18:20:22 +02:00
swift-ci
3512dc809e Merge pull request #3711 from practicalswift/sourcekit-081-swift-genericsignature-getsubstitutionmap 2016-07-23 08:44:44 -07:00
practicalswift
120908e069 [SourceKit] Add test case for crash triggered in swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const
Stack trace:

```
found code completion token A at offset 170
swift-ide-test: /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-ide-test  0x0000000000c3bb56 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 566
9  swift-ide-test  0x0000000000a09d01 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 385
10 swift-ide-test  0x000000000098cde2 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3250
13 swift-ide-test  0x0000000000986ee6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift-ide-test  0x00000000009efc4a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
17 swift-ide-test  0x00000000009efaae swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
18 swift-ide-test  0x00000000009adb0f swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 655
23 swift-ide-test  0x0000000000bbbd34 swift::Decl::walk(swift::ASTWalker&) + 20
24 swift-ide-test  0x0000000000c5449e swift::SourceFile::walk(swift::ASTWalker&) + 174
25 swift-ide-test  0x0000000000c535df swift::ModuleDecl::walk(swift::ASTWalker&) + 79
26 swift-ide-test  0x0000000000c2a6db swift::DeclContext::walkContext(swift::ASTWalker&) + 187
27 swift-ide-test  0x00000000008eeb68 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
28 swift-ide-test  0x00000000007a6efd swift::CompilerInstance::performSema() + 3597
29 swift-ide-test  0x000000000074a181 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl getter for a at <INPUT-FILE>:3:6
2.	While type-checking 'A' at <INPUT-FILE>:3:36
```
2016-07-23 16:42:05 +02:00
practicalswift
5b117c2f80 [SourceKit] Add test case for crash triggered in swift::ValueDecl::getInterfaceType() const
Stack trace:

```
found code completion token A at offset 159
swift-ide-test: /path/to/swift/lib/AST/Decl.cpp:1688: swift::Type swift::ValueDecl::getInterfaceType() const: Assertion `!isa<AbstractFunctionDecl>(this) && "functions should have an interface type"' failed.
8  swift-ide-test  0x0000000000c1d666 swift::ValueDecl::getInterfaceType() const + 422
9  swift-ide-test  0x0000000000c481cd swift::Mangle::Mangler::getDeclTypeForMangling(swift::ValueDecl const*, llvm::ArrayRef<swift::GenericTypeParamType*>&, unsigned int&, llvm::ArrayRef<swift::Requirement>&, llvm::SmallVectorImpl<swift::Requirement>&) + 93
10 swift-ide-test  0x0000000000c480c2 swift::Mangle::Mangler::mangleDeclType(swift::ValueDecl const*, unsigned int) + 114
11 swift-ide-test  0x0000000000c86321 swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 929
13 swift-ide-test  0x00000000007af6d8 copyAssociatedUSRs(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&, swift::Decl const*) + 104
14 swift-ide-test  0x00000000007b055c swift::ide::CodeCompletionResultBuilder::takeResult() + 1676
18 swift-ide-test  0x0000000000c3f7e0 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 256
23 swift-ide-test  0x0000000000bbbd34 swift::Decl::walk(swift::ASTWalker&) + 20
24 swift-ide-test  0x0000000000c5449e swift::SourceFile::walk(swift::ASTWalker&) + 174
25 swift-ide-test  0x0000000000c535df swift::ModuleDecl::walk(swift::ASTWalker&) + 79
26 swift-ide-test  0x0000000000c2a6db swift::DeclContext::walkContext(swift::ASTWalker&) + 187
27 swift-ide-test  0x00000000008eeb68 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
28 swift-ide-test  0x00000000007a6efd swift::CompilerInstance::performSema() + 3597
29 swift-ide-test  0x000000000074a181 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl getter for a at <INPUT-FILE>:3:6
```
2016-07-23 13:30:53 +02:00
practicalswift
091caab41e [SourceKit] Add test case for crash triggered in swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type)
Stack trace:

```
found code completion token A at offset 152
swift-ide-test: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2086: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!canType->hasTypeParameter() && "already have an interface type"' failed.
8  swift-ide-test  0x0000000000b42a35 swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type) + 293
9  swift-ide-test  0x000000000098019f swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5471
10 swift-ide-test  0x00000000009c07f5 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 389
11 swift-ide-test  0x00000000009c2d09 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 265
12 swift-ide-test  0x00000000009816eb swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 363
17 swift-ide-test  0x0000000000986ee6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 swift-ide-test  0x00000000009ab6d2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
19 swift-ide-test  0x00000000007a6dc9 swift::CompilerInstance::performSema() + 3289
20 swift-ide-test  0x000000000074a181 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking 'B' at <INPUT-FILE>:3:1
```
2016-07-23 11:13:53 +02:00
practicalswift
c3af360e2d [SourceKit] Add test case for crash triggered in swift::IterativeTypeChecker::processTypeCheckSuperclass(swift::ClassDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>)
Stack trace:

```
found code completion token A at offset 165
swift-ide-test: /path/to/swift/lib/AST/Decl.cpp:4855: void swift::ClassDecl::setSuperclass(swift::Type): Assertion `(!superclass || !superclass->hasArchetype()) && "superclass must be interface type"' failed.
9  swift-ide-test  0x0000000000a8f92d swift::IterativeTypeChecker::processTypeCheckSuperclass(swift::ClassDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 269
10 swift-ide-test  0x0000000000a72a0d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
11 swift-ide-test  0x000000000097ea90 swift::TypeChecker::resolveSuperclass(swift::ClassDecl*) + 64
12 swift-ide-test  0x0000000000c876c9 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 217
13 swift-ide-test  0x0000000000c8af52 swift::ConformanceLookupTable::lookupConformance(swift::ModuleDecl*, swift::NominalTypeDecl*, swift::ProtocolDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) + 50
14 swift-ide-test  0x0000000000c5007f swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 1103
15 swift-ide-test  0x00000000009cf01a swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 106
16 swift-ide-test  0x00000000009f5b7d swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 1309
20 swift-ide-test  0x00000000009f70be swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
22 swift-ide-test  0x00000000009f8014 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
23 swift-ide-test  0x00000000009f6fb0 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
24 swift-ide-test  0x000000000098010a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5322
25 swift-ide-test  0x00000000009c07f5 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 389
26 swift-ide-test  0x00000000009c2107 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
27 swift-ide-test  0x00000000009c2c6f swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 111
28 swift-ide-test  0x00000000009816eb swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 363
34 swift-ide-test  0x0000000000986ee6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
35 swift-ide-test  0x00000000009ab6d2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
36 swift-ide-test  0x00000000007a6dc9 swift::CompilerInstance::performSema() + 3289
37 swift-ide-test  0x000000000074a181 main + 34609
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 resolving type e at [<INPUT-FILE>:8:11 - line:8:11] RangeText="e"
```
2016-07-23 05:39:46 +02:00
practicalswift
0a27c393b5 [SourceKit] Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&)
Stack trace:

```
found code completion token A at offset 174
4  swift-ide-test  0x0000000000b3b23c swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 28
6  swift-ide-test  0x0000000000c78e43 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 35
7  swift-ide-test  0x0000000000c790de swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 702
8  swift-ide-test  0x0000000000b3b4ba swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 666
9  swift-ide-test  0x0000000000b40715 swift::ArchetypeBuilder::getArchetype(swift::GenericTypeParamDecl*) + 53
10 swift-ide-test  0x00000000009c174f swift::TypeChecker::finalizeGenericParamList(swift::ArchetypeBuilder&, swift::GenericParamList*, swift::DeclContext*) + 191
13 swift-ide-test  0x0000000000981713 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 947
18 swift-ide-test  0x0000000000c3e2d5 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1189
19 swift-ide-test  0x00000000009c5442 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
20 swift-ide-test  0x000000000096db59 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3865
22 swift-ide-test  0x0000000000bba3ab swift::Expr::walk(swift::ASTWalker&) + 27
23 swift-ide-test  0x000000000096e3e0 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
24 swift-ide-test  0x000000000097570c swift::TypeChecker::getTypeOfExpressionWithoutApplying(swift::Expr*&, swift::DeclContext*, swift::ConcreteDeclRef&, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*) + 316
26 swift-ide-test  0x00000000009ac125 swift::getTypeOfCompletionContextExpr(swift::ASTContext&, swift::DeclContext*, swift::CompletionTypeCheckKind, swift::Expr*&, swift::ConcreteDeclRef&) + 693
38 swift-ide-test  0x0000000000bba7f4 swift::Decl::walk(swift::ASTWalker&) + 20
39 swift-ide-test  0x0000000000c52b0e swift::SourceFile::walk(swift::ASTWalker&) + 174
40 swift-ide-test  0x0000000000c51c4f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
41 swift-ide-test  0x0000000000c28e2b swift::DeclContext::walkContext(swift::ASTWalker&) + 187
42 swift-ide-test  0x00000000008ee9f8 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
43 swift-ide-test  0x00000000007a6e9d swift::CompilerInstance::performSema() + 3597
44 swift-ide-test  0x000000000074a001 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl declaration 0x4ebffb0 at <INPUT-FILE>:3:1
2.	While type-checking expression at [<INPUT-FILE>:3:47 - line:3:47] RangeText="t"
3.	While type-checking 'a' at <INPUT-FILE>:3:30
```
2016-07-23 00:26:59 +02:00
swift-ci
f06092192c Merge pull request #3687 from practicalswift/sourcekit-076-swift-typechecker-checkinheritanceclause 2016-07-22 15:22:48 -07:00
practicalswift
2f68b69676 [SourceKit] Add test case for crash triggered in swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*)
Stack trace:

```
found code completion token A at offset 163
swift-ide-test: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2103: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
9  swift-ide-test  0x000000000097ff7f swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5471
10 swift-ide-test  0x00000000009814d8 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
13 swift-ide-test  0x0000000000986d16 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 swift-ide-test  0x00000000009effe4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
17 swift-ide-test  0x0000000000a268cc swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
18 swift-ide-test  0x00000000009752ba swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
21 swift-ide-test  0x00000000009eec5a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
22 swift-ide-test  0x00000000009eeabe swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
23 swift-ide-test  0x00000000009acb6f swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 655
25 swift-ide-test  0x00000000008eeaa1 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 305
26 swift-ide-test  0x00000000007a6e9d swift::CompilerInstance::performSema() + 3597
27 swift-ide-test  0x000000000074a001 main + 34609
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:28 - line:3:38] RangeText="{enum a:e)"
2.	While type-checking 'a' at <INPUT-FILE>:3:29
```
2016-07-22 23:00:24 +02:00
practicalswift
dd6c5306c1 [SourceKit] Add test case for crash triggered in swift::PrintOptions::setArchetypeSelfTransform(swift::Type, swift::DeclContext*)
Stack trace:

```
found code completion token A at offset 152
swift-ide-test: /path/to/swift/lib/AST/ASTPrinter.cpp:68: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type): Assertion `ParamDecls.size() == Args.size()' failed.
9  swift-ide-test  0x0000000000b82c80 swift::PrintOptions::setArchetypeSelfTransform(swift::Type, swift::DeclContext*) + 144
14 swift-ide-test  0x00000000008eeaa1 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 305
15 swift-ide-test  0x00000000007a6e9d swift::CompilerInstance::performSema() + 3597
16 swift-ide-test  0x000000000074a001 main + 34609
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
```
2016-07-22 19:38:20 +02:00
practicalswift
c6158911cf Merge pull request #3668 from practicalswift/sourcekit-074-swift-valuedecl-geteffectiveaccess
[SourceKit] Add test case for crash triggered in swift::ValueDecl::getEffectiveAccess()
2016-07-22 17:40:00 +02:00
practicalswift
1d8d049a9d [SourceKit] Add test case for crash triggered in swift::ValueDecl::getEffectiveAccess() const
Stack trace:

```
found code completion token A at offset 139
swift-ide-test: /path/to/swift/include/swift/AST/Decl.h:2176: swift::Accessibility swift::ValueDecl::getFormalAccess() const: Assertion `hasAccessibility() && "accessibility not computed yet"' failed.
8  swift-ide-test  0x0000000000c1bbae swift::ValueDecl::getEffectiveAccess() const + 606
9  swift-ide-test  0x0000000000c2953d swift::DeclContext::getResilienceExpansion() const + 125
10 swift-ide-test  0x0000000000c1b1b2 swift::ValueDecl::getAccessSemanticsFromContext(swift::DeclContext const*) const + 18
11 swift-ide-test  0x00000000009bcd2d swift::TypeChecker::buildRefExpr(llvm::ArrayRef<swift::ValueDecl*>, swift::DeclContext*, swift::DeclNameLoc, bool, bool) + 125
12 swift-ide-test  0x000000000096e2bd swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3437
14 swift-ide-test  0x0000000000bbadfb swift::Expr::walk(swift::ASTWalker&) + 27
15 swift-ide-test  0x000000000096ed30 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
16 swift-ide-test  0x0000000000975b62 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
19 swift-ide-test  0x00000000009efbca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
20 swift-ide-test  0x00000000009efa2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
21 swift-ide-test  0x00000000009ad5ff swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 655
25 swift-ide-test  0x0000000000bbb244 swift::Decl::walk(swift::ASTWalker&) + 20
26 swift-ide-test  0x0000000000c53dbe swift::SourceFile::walk(swift::ASTWalker&) + 174
27 swift-ide-test  0x0000000000c52eff swift::ModuleDecl::walk(swift::ASTWalker&) + 79
28 swift-ide-test  0x0000000000c298eb swift::DeclContext::walkContext(swift::ASTWalker&) + 187
29 swift-ide-test  0x00000000008eed68 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
30 swift-ide-test  0x00000000007a71ed swift::CompilerInstance::performSema() + 3597
31 swift-ide-test  0x000000000074a351 main + 34593
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl 'init' at <INPUT-FILE>:3:1
2.	While type-checking expression at [<INPUT-FILE>:3:12 - line:3:12] RangeText="a"
```
2016-07-22 00:02:36 +02:00
Doug Gregor
c56f96d237 [Type checker] Synthesize member operator '==' for Equatable enums.
Rather than synthesizing a global operator '==' for Equatable enums,
synthesize a member operator, which is more idiomatic and much
cleaner.

To make sure that these synthesized operators can actually be found,
start considering operator requirements in protocols
more generally in the type checker, so that, e.g., "myEnum == myEnum"
will type-check against Equatable.== and, on successful type-check,
will call the (newly-synthesized) witness for '=='. This both makes it
easier to make sure we find the operators in, e.g., complex multi-file
and lazy-type checking scenarios, and is a step toward the
type-checking improvements described in SE-0091.
2016-07-21 12:54:27 -07:00
practicalswift
57ae3554f3 [SourceKit] Add test case for crash triggered in swift::ArchetypeBuilder::enumerateRequirements(llvm::function_ref<void (swift::RequirementKind, swift::ArchetypeBuilder::PotentialArchetype*, llvm::PointerUnion<swift::Type, swift::ArchetypeBuilder::PotentialArchetype*>, swift::RequirementSource)>)
Stack trace:

```
found code completion token A at offset 160
swift-ide-test: /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-ide-test  0x0000000000b3bf09 swift::ArchetypeBuilder::enumerateRequirements(llvm::function_ref<void (swift::RequirementKind, swift::ArchetypeBuilder::PotentialArchetype*, llvm::PointerUnion<swift::Type, swift::ArchetypeBuilder::PotentialArchetype*>, swift::RequirementSource)>) + 185
11 swift-ide-test  0x0000000000c313e5 swift::GenericSignature::getCanonicalManglingSignature(swift::ModuleDecl&) const + 405
12 swift-ide-test  0x0000000000c3c335 swift::Mangle::Mangler::bindGenericParameters(swift::DeclContext const*) + 53
13 swift-ide-test  0x0000000000c7d7aa swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 762
15 swift-ide-test  0x00000000007aef68 copyAssociatedUSRs(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&, swift::Decl const*) + 104
16 swift-ide-test  0x00000000007afdec swift::ide::CodeCompletionResultBuilder::takeResult() + 1676
20 swift-ide-test  0x0000000000c362c0 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 256
23 swift-ide-test  0x00000000008eccf1 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 305
24 swift-ide-test  0x00000000007a67dd swift::CompilerInstance::performSema() + 3597
25 swift-ide-test  0x0000000000749dd0 main + 34176
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
```
2016-07-21 00:00:01 +02:00
practicalswift
19d579b0a0 [SourceKit] Add test case for crash triggered in 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*> >&)
Stack trace:

```
found code completion token A at offset 180
4  swift-ide-test  0x0000000000a19f12 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*> >&) + 994
6  swift-ide-test  0x0000000000c76783 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 35
7  swift-ide-test  0x0000000000a1862e swift::constraints::ConstraintSystem::openType(swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 78
10 swift-ide-test  0x0000000000bb7fd5 swift::Expr::walk(swift::ASTWalker&) + 69
11 swift-ide-test  0x0000000000930838 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
12 swift-ide-test  0x000000000096b3b3 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 371
13 swift-ide-test  0x0000000000971d52 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
14 swift-ide-test  0x0000000000972f07 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
15 swift-ide-test  0x000000000097311b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
17 swift-ide-test  0x000000000097e79d swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
20 swift-ide-test  0x0000000000c3ae22 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 562
36 swift-ide-test  0x0000000000bb8384 swift::Decl::walk(swift::ASTWalker&) + 20
37 swift-ide-test  0x0000000000c500fe swift::SourceFile::walk(swift::ASTWalker&) + 174
38 swift-ide-test  0x0000000000c4f23f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
39 swift-ide-test  0x0000000000c25e2b swift::DeclContext::walkContext(swift::ASTWalker&) + 187
40 swift-ide-test  0x00000000008ec518 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
41 swift-ide-test  0x00000000007a672d swift::CompilerInstance::performSema() + 3597
42 swift-ide-test  0x0000000000749d20 main + 34176
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl declaration 0x4e04dd0 at <INPUT-FILE>:3:1
2.	While type-checking expression at [<INPUT-FILE>:5:7 - line:5:7] RangeText="B"
```
2016-07-18 21:10:17 +02:00
swift-ci
391e10e6fe Merge pull request #3561 from practicalswift/sourcekit-071-swift-printoptions-setarchetypetransform 2016-07-17 18:09:18 -07:00
practicalswift
4e4fff4373 [SourceKit] Add test case for crash triggered in swift::PrintOptions::setArchetypeTransform(swift::Type, swift::DeclContext*)
Stack trace:

```
found code completion token A at offset 154
swift-ide-test: /path/to/swift/lib/AST/ASTPrinter.cpp:68: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type): Assertion `ParamDecls.size() == Args.size()' failed.
9  swift-ide-test  0x0000000000b7da00 swift::PrintOptions::setArchetypeTransform(swift::Type, swift::DeclContext*) + 144
16 swift-ide-test  0x0000000000bb3694 swift::Decl::walk(swift::ASTWalker&) + 20
17 swift-ide-test  0x0000000000c4b40e swift::SourceFile::walk(swift::ASTWalker&) + 174
18 swift-ide-test  0x0000000000c4a54f swift::ModuleDecl::walk(swift::ASTWalker&) + 79
19 swift-ide-test  0x0000000000c2113b swift::DeclContext::walkContext(swift::ASTWalker&) + 187
20 swift-ide-test  0x00000000008ec438 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
21 swift-ide-test  0x00000000007a668d swift::CompilerInstance::performSema() + 3597
22 swift-ide-test  0x0000000000749c80 main + 34176
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While walking into decl getter for b at <INPUT-FILE>:3:6
```
2016-07-17 23:26:13 +02:00
practicalswift
581103d766 [SourceKit] Add test case for crash triggered in swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type, swift::LazyResolver*)
Stack trace:

```
found code completion token A at offset 151
4  swift-ide-test  0x0000000000b3c793 swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type, swift::LazyResolver*) + 163
5  swift-ide-test  0x0000000000a19f1b 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*> >&) + 1051
7  swift-ide-test  0x0000000000c71a83 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 35
8  swift-ide-test  0x0000000000a185fe 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
11 swift-ide-test  0x0000000000bb32e5 swift::Expr::walk(swift::ASTWalker&) + 69
12 swift-ide-test  0x0000000000930758 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
13 swift-ide-test  0x000000000096b353 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
14 swift-ide-test  0x0000000000971cf2 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
17 swift-ide-test  0x00000000009ebae4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
18 swift-ide-test  0x0000000000a229ac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
19 swift-ide-test  0x0000000000971d91 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
22 swift-ide-test  0x00000000009ea75a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
23 swift-ide-test  0x00000000009ea5be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
24 swift-ide-test  0x00000000009a89af swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 655
26 swift-ide-test  0x00000000008ec4e1 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 305
27 swift-ide-test  0x00000000007a668d swift::CompilerInstance::performSema() + 3597
28 swift-ide-test  0x0000000000749c80 main + 34176
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:23 - line:4:1] RangeText="{B
"
2.	While type-checking expression at [<INPUT-FILE>:3:24 - line:3:24] RangeText="B"
```
2016-07-17 12:03:10 +02:00
practicalswift
6b8d883948 [SourceKit] Add test case for crash triggered in swift::TypeChecker::typeCheckParameterList(swift::ParameterList*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*)
Stack trace:

```
found code completion token A at offset 137
5  swift-ide-test  0x00000000009c30f5 swift::TypeChecker::typeCheckParameterList(swift::ParameterList*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 117
8  swift-ide-test  0x0000000000982d96 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
9  swift-ide-test  0x00000000009a6142 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
10 swift-ide-test  0x00000000007a64d9 swift::CompilerInstance::performSema() + 3289
11 swift-ide-test  0x0000000000749c4a main + 34106
Stack dump:
0.	Program arguments: swift-ide-test -code-completion -code-completion-token=A -source-filename=<INPUT-FILE>
1.	While type-checking 'b' at <INPUT-FILE>:3:1
```
2016-07-16 21:09:27 +02:00
Doug Gregor
823c24b355 [SE-0112] Rename ErrorProtocol to Error.
This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
2016-07-12 10:53:52 -07:00
Ben Langmuir
75619c02c4 [CodeCompletion] Improve StmtCondition recovery for code-completion
In the condition expressions of if, while and guard statements we were
throwing away the AST if there was a parse error in the condition, or
the brace statement was missing.  This led to poor code-completion for
unresolved members (enums, options sets) because we couldn't find the
parent expression to type-check.

There are a few minor diagnostic changes because we now do more
type-checking of these conditions, particularly if they end up
containing an unused closure.

SR-2001
2016-07-06 14:08:53 -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
edc29363ed For some reason this crasher was not in crashers_fixed 2016-06-18 17:05:26 -07: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
bbefeb2fc5 Sema: Better support for nested generic functions
There was a weird corner case with nested generic functions that
would fail in the SIL verifier with some nonsense about archetypes
out of context.

Fix this the "right" way, by re-working Sema function declaration
validation to assign generic signatures in a more principled way.

Previously, nested functions did not get an interface type unless
they themselves had generic parameters.

This was inconsistent with methods nested inside generic types,
which did get an interface type even if they themselves did not
have a generic parameter list.

There's some spill-over in SILGen from this change. Mostly it
makes things more consistent and fixes some corner cases.
2016-06-13 01:22:43 -07:00
Slava Pestov
3127264376 AST: When performing qualified lookup of a member type, filter out non-types earlier
With the previous resolveTypeInContext() patch, a few compiler
crashers regressed with this problem, presumably because we were now
performing lookups in more contexts than before.

This is a class of problems where we would attempt a recursive
validation:

1) Generic signature validation begins for type T
2) Name lookup in type context finds a non-type declaration D nested in T
3) Generic signature validation begins for D
4) The outer generic context of D is T, but T doesn't have a generic
   signature yet

The right way to break such cycles is to implement the iterative
decl checker design. However when the recursion is via name lookup,
we can try to avoid the problem in the first place by not validating
non-type declarations if the client requested a type-only lookup.

Note that there is a small semantic change here, where programs that
were previously rejected as invalid because of name clashes are
now valid. It is arguable if we want to allow stuff like this or not:

class A {
  func A(a: A) {}
}

or

class Case {}
enum Foo {
  case Case(Case)
}

However at the very least, the new behavior is better because it
gives us an opportunity to add a diagnostic in the right place
later. The old diagnostics were not very good, for example the
second example just yields "use of undeclared type 'Case'".
In other examples, the undeclared type diagnostic would come up
multiple times, or we would generate a cryptic "type 'A' used within
its own definition".

As far as I understand, this should not change behavior of any existing
valid code.
2016-06-11 16:27:43 -07:00