Skip to content

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

Open
strfn wants to merge 3 commits intorockbruno: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 intorockbruno:masterfrom
strfn:feature/sdk_mode_bugfix

Conversation

@strfn
Copy link

@strfn strfn commented Jun 7, 2021

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
Copy link
Author

strfn commented Jun 8, 2021

@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
Owner

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

@strfn
Copy link
Author

strfn commented Jun 21, 2022

FYI tests are green now

Copy link
Owner

@rockbruno rockbruno left a comment

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