Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0172-rdar-44235762.swift
Doug Gregor 8a2ce9bdf7 [Associated type inference] Never infer a type involving archetypes and interface types.
Works around an oddity of the associated type inference when the
potential witness is generic and returns (e.g.) Self.

Associated type inference needs to move off of archetypes for the
implementation to become sane. For now, this eliminates a crash.

Fixes rdar://problem/43591024.
2018-09-07 14:20:41 -07:00

21 lines
360 B
Swift

// RUN: not %target-swift-frontend -typecheck %s
// Was crashing in associated type inference.
protocol P {
associatedtype Assoc
subscript(i: Int) -> Assoc { get }
func f() -> Assoc
}
struct X<T, U> { }
extension P {
subscript<T>(i: T) -> X<T, Self> { return X<T, Self>() }
func f<T>() -> X<T, Self> { return X<T, Self> }
}
struct Y<T>: P { }