mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Member lookup in the GSB needs to understand equivalence classes with concrete types.
A constraint like `Parameter == SomethingConcrete` means references to `Parameter` in that context behave like `SomethingConcrete`, including for name resolution. Handling the parameter as just a parameter type means that it won't find any non-protocol nested types (i.e. things other than associated types and protocol typealiases are invisible). Fixes rdar://problem/42136457 and SR-8240.
This commit is contained in:
14
validation-test/compiler_crashers_2_fixed/0165-sr8240.swift
Normal file
14
validation-test/compiler_crashers_2_fixed/0165-sr8240.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
struct Box<Representation> {
|
||||
let value: Representation
|
||||
}
|
||||
enum Repr {}
|
||||
extension Repr {
|
||||
typealias RawEnum = ()
|
||||
}
|
||||
extension Box where Representation == Repr {
|
||||
init(rawEnumValue: Representation.RawEnum) {
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
struct Box<Representation, T> {
|
||||
let value: Representation
|
||||
}
|
||||
enum Repr {}
|
||||
extension Repr {
|
||||
typealias RawEnum = ()
|
||||
}
|
||||
extension Box where Representation == Repr, T == Representation.RawEnum {
|
||||
init(rawEnumValue: Representation.RawEnum) {
|
||||
let _: Int.Type = T.self // expected-error {{cannot convert value of type '().Type' to specified type 'Int.Type'}}
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user