// RUN: not --crash %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
var a{protocol A{struct a{func d<T{class B:T a{#^A^#
Add test case for crash triggered in swift::ArchetypeBuilder::addGenericParameter(swift::GenericTypeParamType*)
[SourceKit] Add test case for crash triggered in swift::ArchetypeBuilder::addGenericParameter(swift::GenericTypeParamType*)

Stack trace:

```
found code completion token A at offset 152
swift-ide-test: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:721: swift::ArchetypeBuilder::PotentialArchetype *swift::ArchetypeBuilder::addGenericParameter(swift::GenericTypeParamType *, swift::ProtocolDecl *, swift::Identifier): Assertion `!Impl->PotentialArchetypes[Key]' failed.
9  swift-ide-test  0x0000000000a98f1a swift::ArchetypeBuilder::addGenericParameter(swift::GenericTypeParamType*) + 106
10 swift-ide-test  0x0000000000a9c3ae swift::ArchetypeBuilder::addGenericSignature(swift::GenericSignature*, bool, bool) + 94
11 swift-ide-test  0x0000000000b57713 swift::GenericSignature::getCanonicalManglingSignature(swift::ModuleDecl&) const + 243
12 swift-ide-test  0x0000000000b644c5 swift::Mangle::Mangler::getDeclTypeForMangling(swift::ValueDecl const*, llvm::ArrayRef<swift::GenericTypeParamType*>&, unsigned int&, llvm::ArrayRef<swift::Requirement>&, llvm::SmallVectorImpl<swift::Requirement>&) + 165
13 swift-ide-test  0x0000000000b642a4 swift::Mangle::Mangler::mangleDeclType(swift::ValueDecl const*, swift::ResilienceExpansion, unsigned int) + 116
14 swift-ide-test  0x0000000000b9fe7f swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 815
16 swift-ide-test  0x000000000077bd88 copyAssociatedUSRs(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&, swift::Decl const*) + 104
17 swift-ide-test  0x000000000077c508 swift::ide::CodeCompletionResultBuilder::takeResult() + 1624
21 swift-ide-test  0x0000000000b5bf8d swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1117
26 swift-ide-test  0x0000000000ae6734 swift::Decl::walk(swift::ASTWalker&) + 20
27 swift-ide-test  0x0000000000b6fbce swift::SourceFile::walk(swift::ASTWalker&) + 174
28 swift-ide-test  0x0000000000b6efaf swift::ModuleDecl::walk(swift::ASTWalker&) + 79
29 swift-ide-test  0x0000000000b49722 swift::DeclContext::walkContext(swift::ASTWalker&) + 146
30 swift-ide-test  0x000000000086599d swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 61
31 swift-ide-test  0x0000000000774304 swift::CompilerInstance::performSema() + 3316
32 swift-ide-test  0x000000000071cc33 main + 35011
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>:2:6
```
