Files
swift-mirror/test/ModuleInterface/skip-override-keyword.swift
Xi Ge 75abee8f45 ModuleInterface: skip override keywords when overriding an invisible decl from super class
When we are printing Swift interface, we have to skip the override keyword
if the overriden decl is invisible from the interface. Otherwise, an error
will occur while building the Swift module because the overriding decl
doesn't override anything.

We couldn't skip every `override` keywords because they change the
ABI if the overriden decl is also publicly visible.

For public-override-internal case, having `override` doesn't have ABI
implication. Thus we can skip them.

rdar://58562780
2020-03-19 11:47:54 -07:00

15 lines
617 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -typecheck -module-name Foo -emit-module-interface-path %t/Foo.swiftinterface %s
// RUN: %target-swift-frontend -compile-module-from-interface %t/Foo.swiftinterface -o %t/Foo.swiftmodule
public class BaseClass {
var property: Int { return 1 }
func doSomething() { }
subscript(index: Int) -> Int { get { return 0 } set(newValue) {} }
}
public class DerivedClass: BaseClass {
public override var property : Int { return 0 }
public override func doSomething() { }
public override subscript(index: Int) -> Int { get {return 0} set(newValue) {} }
}