Files
swift-mirror/test/decl/class/circular_inheritance.swift
David Farler b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00

29 lines
886 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{{circular protocol inheritance P}}
class Isomorphism : Automorphism { }
class Automorphism : Automorphism { } // expected-error{{circular class inheritance Automorphism}}
let _ = A()
// This should probably be made to work, but for now test that it produces a crappy
// diagnostic instead of crashing
class Left : Right.Hand {
class Hand {}
}
class Right : Left.Hand { // expected-error {{class 'Hand' is not a member type of 'Left'}}
class Hand {}
}
class Outer {
class Inner : Outer {}
}