// RUN: not --crash %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
// REQUIRES: asserts
{protocol a{typealias B:a
var T>typealias d:a{#^A^#
Add test case for crash triggered in swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, swift::GenericEnvironment*, bool)
[SourceKit] Add test case for crash triggered in swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, swift::GenericEnvironment*, bool)

Stack trace:

```
found code completion token A at offset 172
swift-ide-test: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1515: void swift::ArchetypeBuilder::addRequirement(const swift::Requirement &, swift::RequirementSource): Assertion `!invalid && "Re-introducing invalid requirement"' failed.
8  swift-ide-test  0x0000000000be54d0 swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, swift::GenericEnvironment*, bool) + 448
9  swift-ide-test  0x0000000000a610d6 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, swift::GenericEnvironment*, swift::GenericTypeResolver*) + 54
11 swift-ide-test  0x0000000000a615cb swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 91
14 swift-ide-test  0x0000000000a26166 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
15 swift-ide-test  0x0000000000aa34b1 swift::convertStoredVarInProtocolToComputed(swift::VarDecl*, swift::TypeChecker&) + 113
16 swift-ide-test  0x0000000000aaaa99 swift::maybeAddAccessorsToVariable(swift::VarDecl*, swift::TypeChecker&) + 2521
17 swift-ide-test  0x0000000000a206ba swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3178
19 swift-ide-test  0x0000000000cbb458 swift::Pattern::forEachVariable(std::function<void (swift::VarDecl*)> const&) const + 216
23 swift-ide-test  0x0000000000a26166 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
26 swift-ide-test  0x0000000000a91ec6 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 262
27 swift-ide-test  0x0000000000ac6e4c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 812
28 swift-ide-test  0x0000000000a12144 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1092
30 swift-ide-test  0x0000000000a92066 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
31 swift-ide-test  0x0000000000a4ca3a swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1162
32 swift-ide-test  0x00000000008383e6 swift::CompilerInstance::performSema() + 3350
33 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 type-checking expression at [<INPUT-FILE>:3:1 - line:4:21] RangeText="{protocol a{typealias B:a
var T>typealias d:a{"
2.	While type-checking 'a' at <INPUT-FILE>:3:2
3.	While type-checking getter for T at <INPUT-FILE>:4:5
```
