Skip to content

Public static var/func not identified as public if exported to objc#128

Open
strfn wants to merge 3 commits into
rockbruno:masterfrom
strfn:feature/sdk_mode_bugfix
Open

Public static var/func not identified as public if exported to objc#128
strfn wants to merge 3 commits into
rockbruno:masterfrom
strfn:feature/sdk_mode_bugfix

Conversation

@strfn

@strfn strfn commented Jun 7, 2021

Copy link
Copy Markdown

Given a protocol defined as

@objc public protocol AProtocol {
   static func pubfunction()
   static var pubvariable: Int { get }
}

SourceKit do not reports the right ACL in the attributes list. The right ACL is resported instead in key.effective_access

key.entities: [
        {
          key.kind: source.lang.swift.decl.function.method.static,
          key.name: "decision()",
          key.usr: "c:@M@Module@objc(pl)Name(cm)pubfunction",
          key.line: 23,
          key.column: 17,
          key.attributes: [
            {
              key.attribute: source.decl.attribute.objc
            }
          ],
          key.effective_access: source.decl.effective_access.public
        },
......

This MR try to address this behaviour looking into the effective_access property to identify public entities in SDK mode.

@strfn

strfn commented Jun 8, 2021

Copy link
Copy Markdown
Author

@rockbruno Any idea why this is failing ? Tests are green on MacOS
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.5.0

Maybe a difference in SourceKit ?

@rockbruno

Copy link
Copy Markdown
Owner

The CI here is configured for Xcode 12.4 (Swift 5.3, I think?), so this feature likely changed recently in SourceKit

@strfn

strfn commented Jun 21, 2022

Copy link
Copy Markdown
Author

FYI tests are green now

@rockbruno rockbruno left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants