// 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
protocol A
extension A
class d<w{struct B:A{let b=a

Add test case for crash triggered in swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc)
[swiftc] Add test case for crash triggered in swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc)

Stack trace:

```
swift: /path/to/swift/lib/Sema/CSGen.cpp:3315: bool swift::isExtensionApplied(swift::DeclContext &, swift::Type, const swift::ExtensionDecl *): Assertion `GenericParams.size() == GenericArgs.size()' failed.
12 swift           0x00000000010d0c86 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1174
13 swift           0x0000000000edc344 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 260
14 swift           0x0000000000e86f78 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3864
16 swift           0x000000000104e623 swift::Expr::walk(swift::ASTWalker&) + 19
17 swift           0x0000000000e87797 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 119
18 swift           0x0000000000e8e152 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
19 swift           0x0000000000e8f2a7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
20 swift           0x0000000000e8f4bb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000ea0546 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
28 swift           0x0000000000ec37f2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 994
29 swift           0x0000000000c58c79 swift::CompilerInstance::performSema() + 3289
31 swift           0x00000000007d6eef swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2863
32 swift           0x00000000007a2ef8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28299-swift-lookupvisibledecls.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28299-swift-lookupvisibledecls-cad1b5.o
1.	While type-checking 'd' at validation-test/compiler_crashers/28299-swift-lookupvisibledecls.swift:12:1
2.	While type-checking expression at [validation-test/compiler_crashers/28299-swift-lookupvisibledecls.swift:12:28 - line:12:28] RangeText="a"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
