Skip to content

Generated code doesn't compile in Swift 6 Language Mode #91

Closed
@aeigenmann

Description

@aeigenmann

Is there an existing issue?

Build info

  • ObjectBox version: 4.1.0-beta.2
  • OS: macOS 15.3.1
  • Device/chipset: Apple M1 Pro

Steps to reproduce

Entity:

// objectbox: entity
struct Recipe: Identifiable, Codable {
    var id: Id = 0
    var name: String
}

Generated code:

extension Recipe: ObjectBox.EntityInspectable {
    internal typealias EntityBindingType = RecipeBinding

    /// Generated metadata used by ObjectBox to persist the entity.
    internal static var entityInfo = ObjectBox.EntityInfo(name: "Recipe", id: 1)

    internal static var entityBinding = EntityBindingType()
...
}

Compilation Errors:

Static property 'entityInfo' is not concurrency-safe because it is nonisolated global shared mutable state
Static property 'entityBinding' is not concurrency-safe because it is nonisolated global shared mutable state

Expected behavior

The generated code should be compilable.

Actual behavior

Compilation error

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions