Files
swift-mirror/test/decl/protocol/req/recursion.swift
Doug Gregor 38c1de69e4 Reinstate "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit ce7b2bcf09, tweaking
a few validation tests appropriately (1 crasher fixed, two -verify
tests that needed updating).
2016-01-14 00:21:48 -08:00

23 lines
709 B
Swift

// RUN: %target-parse-verify-swift
protocol SomeProtocol {
associatedtype T
}
extension SomeProtocol where T == Optional<T> { } // expected-error{{same-type constraint 'Self.T' == 'Optional<Self.T>' is recursive}}
// rdar://problem/20000145
public protocol P {
associatedtype T
}
public struct S<A: P where A.T == S<A>> {}
// rdar://problem/19840527
class X<T where T == X> { // expected-error{{same-type requirement makes generic parameter 'T' non-generic}}
var type: T { return self.dynamicType } // expected-error{{cannot convert return expression of type 'X<T>.Type' to return type 'T'}}
}
protocol Y {
associatedtype Z = Z // expected-error{{type alias 'Z' circularly references itself}}
}