Skip to content

"public private(set) var" pattern fails to compile #535

@abdulowork

Description

@abdulowork

Reproduction

Found while testing #486. Reproducible with the following code in:

public class Foo {
    public private(set) var bar: String {
        get { fatalError("") }
        set { fatalError("") }
    }
}

in the Samples/SwiftJavaExtractFFMSampleApp/Sources/MySwiftLibrary/Foo.swift. This currently emits the following bridge and a compilation error:

error: cannot assign to property: 'bar' setter is inaccessible
 16 | @_cdecl("swiftjava_MySwiftLibrary_Foo_bar$set")
 17 | public func swiftjava_MySwiftLibrary_Foo_bar$set(_ newValue: UnsafePointer<Int8>, _ self: UnsafeRawPointer) {
 18 |   self.assumingMemoryBound(to: Foo.self).pointee.bar = String(cString: newValue)
    |                                                  `- error: cannot assign to property: 'bar' setter is inaccessible

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:jextractIssues related to jextract-swift

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions