// RUN: not --crash %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
// REQUIRES: asserts
let a{func j<T{enum b:T{case#^A^#
Add test case for crash triggered in swift::DerivedConformance::deriveRawRepresentable(swift::TypeChecker&, swift::Decl*, swift::NominalTypeDecl*, swift::AssociatedTypeDecl*)
[SourceKit] Add test case for crash triggered in swift::DerivedConformance::deriveRawRepresentable(swift::TypeChecker&, swift::Decl*, swift::NominalTypeDecl*, swift::AssociatedTypeDecl*)

Stack trace:

```
found code completion token A at offset 154
swift-ide-test: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1988: static swift::Type swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl *, swift::GenericEnvironment *, swift::Type): Assertion `env && "dependent type in non-generic context"' failed.
9  swift-ide-test  0x0000000000b16cf9 swift::DerivedConformance::deriveRawRepresentable(swift::TypeChecker&, swift::Decl*, swift::NominalTypeDecl*, swift::AssociatedTypeDecl*) + 57
12 swift-ide-test  0x0000000000a7331a swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 218
13 swift-ide-test  0x0000000000cc71d3 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 147
14 swift-ide-test  0x0000000000cc7118 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
15 swift-ide-test  0x0000000000a671ee swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 1166
16 swift-ide-test  0x00000000009ed9f2 swift::constraints::ConstraintSystem::performMemberLookup(swift::constraints::ConstraintKind, swift::DeclName, swift::Type, swift::FunctionRefKind, swift::constraints::ConstraintLocator*, bool) + 2674
17 swift-ide-test  0x00000000009ef5a8 swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 296
18 swift-ide-test  0x00000000009f0867 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 71
19 swift-ide-test  0x00000000009f45da swift::constraints::ConstraintSystem::simplify(bool) + 106
20 swift-ide-test  0x00000000009f5a22 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 50
21 swift-ide-test  0x00000000009f55b9 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 73
22 swift-ide-test  0x00000000009f54eb swift::constraints::ConstraintSystem::solveSingle(swift::FreeTypeVariableBinding) + 59
28 swift-ide-test  0x0000000000a70aa3 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 1859
29 swift-ide-test  0x0000000000a710a5 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 485
32 swift-ide-test  0x0000000000a273f6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
35 swift-ide-test  0x0000000000a97b03 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 355
36 swift-ide-test  0x0000000000a97957 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 39
37 swift-ide-test  0x0000000000a4f751 swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 657
42 swift-ide-test  0x0000000000c5c374 swift::Decl::walk(swift::ASTWalker&) + 20
43 swift-ide-test  0x0000000000cb106e swift::SourceFile::walk(swift::ASTWalker&) + 174
44 swift-ide-test  0x0000000000cb037f swift::ModuleDecl::walk(swift::ASTWalker&) + 95
45 swift-ide-test  0x0000000000c86e44 swift::DeclContext::walkContext(swift::ASTWalker&) + 180
46 swift-ide-test  0x0000000000988e68 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 136
47 swift-ide-test  0x0000000000838cb1 swift::CompilerInstance::performSema() + 3697
48 swift-ide-test  0x00000000007d9494 main + 42580
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:5
2.	While type-checking 'b' at <INPUT-FILE>:3:16
```
