Files
swift-mirror/test/decl/protocol/req/recursion.swift
Slava Pestov c258f991f6 Sema: Nuke NominalTypeDecl::markInvalidGenericSignature()
This would just set the NominalTypeDecl's declared type to
ErrorType, which caused problems elsewhere.

Instead, generalize the logic used for AbstractFunctionDecl.
This correctly wires up the GenericTypeParamDecl's archetypes even
if the signature didn't validate, fixing crashes if the generic
parameters of the type are referenced.
2015-12-14 13:29:55 -08:00

23 lines
694 B
Swift

// RUN: %target-parse-verify-swift
protocol SomeProtocol {
typealias 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 {
typealias 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 {
typealias Z = Z // expected-error{{type alias 'Z' circularly references itself}}
}