// 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
// REQUIRES: asserts
class c<a{protocol A<>:B{}typealias B<T>:T

Add 💥 (😢 → 58, 😀 → 5099) in swift::TypeChecker::checkInheritanceClause(…)
Add 💥 (😢 → 58, 😀 → 5099) in swift::TypeChecker::checkInheritanceClause(…)

Add test case for crash triggered in `swift::TypeChecker::checkInheritanceClause(…)`.

Assertion failure:
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
```

<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
9  swift           0x0000000000eabaef swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5279
13 swift           0x0000000000eb2686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
14 swift           0x0000000000ed486a swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1162
15 swift           0x0000000000c616a9 swift::CompilerInstance::performSema() + 3289
17 swift           0x00000000007d8419 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
18 swift           0x00000000007a4448 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28347-swift-typechecker-checkinheritanceclause.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28347-swift-typechecker-checkinheritanceclause-4fd285.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28347-swift-typechecker-checkinheritanceclause.swift:10:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
