mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Extensions cannot capture generic parameters from outer contexts. Their generic parameter list does not point to the outer parameter list, the signature does not contain outer parameters and they do not appear in the extension's generic environment. Furthermore, the depth/index of the extension's parameters may clash with outer parameters, which would break all kinds of invariants. This patch changes these DeclContext methods to return false or nullptr even if an extension is contained in a generic context: - isGenericContext() - getGenericParamsOfContext() - getGenericSignatureOfContext() - getGenericEnvironmentOfContext()
18 lines
522 B
Swift
18 lines
522 B
Swift
// 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 https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
|
|
// RUN: not %target-swift-frontend %s -emit-ir
|
|
// REQUIRES: asserts
|
|
class A{let f= <c
|
|
protocol A{
|
|
typealias e:A{}
|
|
protocol A{
|
|
extension{
|
|
protocol A{func<{{}
|
|
}typealias e:
|
|
c
|