Files
swift-mirror/test/Interpreter/Inputs/vtables_multifile_2.swift
Slava Pestov e2d660f148 SILGen: Fix generated vtable thunk when a final override is more visible than the base
Don't re-dispatch to the override's vtable slot if the override
is final; there's no vtable slot and this will result in an
infinite loop.

Fixes <rdar://problem/52006394>.
2019-06-21 22:56:48 -04:00

29 lines
513 B
Swift

open class Base {
public init() {}
fileprivate func privateMethod() -> Int {
return 1
}
}
open class Derived : Base {
open override func privateMethod() -> Int {
return super.privateMethod() + 1
}
}
public final class FinalDerived : Base {
public override func privateMethod() -> Int {
return super.privateMethod() + 1
}
}
public func callBaseMethod(_ b: Base) -> Int {
return b.privateMethod()
}
public func callDerivedMethod(_ d: Derived) -> Int {
return d.privateMethod()
}