// RUN: %target-swift-frontend -emit-sil -O -emit-object %s // We used to crash on this when trying to devirtualize a.doSomething(), // because a is A and B is a subclass of A, but not a // subclass A. And we were not filtering the results of the // ClassHierarchyAnalysis to handle such cases properly and // as a result, we were trying to cast A into B, which is // impossible. // // rdar://21188939 public class A { @inline(never) func doSomething() -> Int32 { return 100 } } final class B: A { } final class C: A { } final class D: A { } @inline(never) public func testDevirt(a: A) -> Int32 { return a.doSomething() }