Files
swift-mirror/validation-test/Sema/rdar47334176.swift
Pavel Yaskevich 33cff97ab2 [Sema] Fix resolveDependentMemberType to properly handle nested types found in enum/struct/class
Currently if member has been found through same-type constraint
it would only be properly handled when it comes from a class type,
because that's the only time when base type gets replaced with
"concrete" type from equivalence class, but nested types could also
come from structs, enums and sometimes protocols (e.g. typealias)
which `resolveDependentMemberType` has to handle.

Resolves: rdar://problem/47334176
2019-01-20 01:59:40 -08:00

14 lines
584 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -o %t/rdar47334176_types.swiftmodule %S/Inputs/rdar47334176_types.swift
// RUN: %target-swift-frontend -I %t -typecheck %s
import rdar47334176_types
// To test all possibilities let's declare one of the types
// in the same module as function declaration which uses it.
struct S<V> : R {}
func foo<T : P, U>(_: T?, _: (T.V.V) -> Void) where T.V == E<U> {} // Ok
func bar<T : P, U>(_: T?, _: (T.V.V) -> Void) where T.V == S<U> {} // Ok
func baz<T : P, U>(_: T?, _: (T.V.V) -> Void) where T.V == C<U> {} // Ok