Files
swift-mirror/test/decl/class/circular_inheritance.swift
Doug Gregor 8bd863e645 [GSB] Reimplement self-derived checking for conformance constraints.
The general self-derived check doesn't really make sense for
conformance constraints, because we want to distinguish among
different protocol conformances.
2017-03-23 23:45:43 -07:00

35 lines
924 B
Swift

// RUN: %target-typecheck-verify-swift
class C : B { } // expected-error{{circular class inheritance 'C' -> 'B' -> 'A' -> 'C'}}
class B : A { } // expected-note{{class 'B' declared here}}
class A : C { } // expected-note{{class 'A' declared here}}
class TrivialCycle : TrivialCycle {} // expected-error{{circular class inheritance TrivialCycle}}
protocol P : P {} // expected-error 2{{circular protocol inheritance P}}
class Isomorphism : Automorphism { }
class Automorphism : Automorphism { } // expected-error{{circular class inheritance Automorphism}}
// FIXME: Useless error
let _ = A() // expected-error{{'A' cannot be constructed because it has no accessible initializers}}
class Left : Right.Hand {
class Hand {}
}
class Right : Left.Hand {
class Hand {}
}
class Outer {
class Inner : Outer {}
}
class Outer2 : Outer2.Inner {
class Inner {}
}
class Outer3 : Outer3.Inner<Int> {
class Inner<T> {}
}