// This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -parse
enum S<T where S.e=p{
struct e<T:a
class a

Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&)
[swiftc] Add test case for crash triggered in swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&)

Stack trace:

```
4  swift           0x0000000000f6acdc swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 28
6  swift           0x000000000109a93d swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 45
7  swift           0x000000000109abc7 swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 695
8  swift           0x000000000109aa49 swift::Type::transform(std::function<swift::Type (swift::Type)> const&) const + 313
9  swift           0x0000000000f6af7f swift::ArchetypeBuilder::PotentialArchetype::getType(swift::ArchetypeBuilder&) + 703
10 swift           0x0000000000f70285 swift::ArchetypeBuilder::getArchetype(swift::GenericTypeParamDecl*) + 53
12 swift           0x0000000000e44e2a swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 506
13 swift           0x0000000001082f2c swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3612
14 swift           0x0000000000e85347 swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 295
16 swift           0x0000000000eaf42e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
18 swift           0x0000000000eb0344 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
19 swift           0x0000000000eaf32a swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 42
20 swift           0x0000000000e80a06 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 582
21 swift           0x0000000000e82047 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
22 swift           0x0000000000e823e6 swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 102
23 swift           0x0000000000e44d9f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 367
26 swift           0x0000000000e4a8b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
27 swift           0x0000000000e6dc92 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1026
28 swift           0x0000000000cbefbf swift::CompilerInstance::performSema() + 3087
30 swift           0x000000000078bb5f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495
31 swift           0x0000000000786625 main + 2837
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28273-swift-archetypebuilder-potentialarchetype-gettype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28273-swift-archetypebuilder-potentialarchetype-gettype-44bd17.o
1.	While type-checking 'S' at validation-test/compiler_crashers/28273-swift-archetypebuilder-potentialarchetype-gettype.swift:5:1
2.	While resolving type S.e at [validation-test/compiler_crashers/28273-swift-archetypebuilder-potentialarchetype-gettype.swift:5:16 - line:5:18] RangeText="S.e"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
