mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuleInterface: skip printing the override keyword if the overriden decl is skipped
rdar://80918826
This commit is contained in:
@@ -747,6 +747,10 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
|
||||
// implication. Thus we can skip them.
|
||||
if (auto *VD = dyn_cast<ValueDecl>(D)) {
|
||||
if (auto *BD = VD->getOverriddenDecl()) {
|
||||
// If the overriden decl won't be printed, printing override will fail
|
||||
// the build of the interface file.
|
||||
if (!Options.shouldPrint(BD))
|
||||
return false;
|
||||
if (!BD->hasClangNode() &&
|
||||
!BD->getFormalAccessScope(VD->getDeclContext(),
|
||||
/*treatUsableFromInlineAsPublic*/ true)
|
||||
|
||||
11
test/ModuleInterface/skip-override-spi.swift
Normal file
11
test/ModuleInterface/skip-override-spi.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %empty-directory(%t/inputs)
|
||||
// RUN: %empty-directory(%t/modulecache)
|
||||
// RUN: echo "public class HideyHole { @_spi(Private) public init() {} }" > %t/Foo.swift
|
||||
// RUN: echo "public class StashyCache: HideyHole {}" >> %t/Foo.swift
|
||||
|
||||
// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/inputs/Foo.swiftinterface %t/Foo.swift -module-name Foo
|
||||
|
||||
// RUN: %target-swift-frontend -emit-module-path %t/Bar.swiftmodule -enable-library-evolution -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name Bar %s -I %t/inputs -disable-availability-checking -module-cache-path %t/modulecache
|
||||
|
||||
import Foo
|
||||
Reference in New Issue
Block a user