You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extensionRecipe:ObjectBox.EntityInspectable{internaltypealiasEntityBindingType=RecipeBinding
/// Generated metadata used by ObjectBox to persist the entity.
internalstaticvarentityInfo=ObjectBox.EntityInfo(name:"Recipe", id:1)internalstaticvarentityBinding=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
The text was updated successfully, but these errors were encountered:
I guess these must be immutable. By using static let instead of static var, you’re making the properties immutable and inherently thread-safe, which satisfies Swift’s concurrency rules.
Unfortunately, static let alone is not enough. This leads to the error messages:
Static property 'entityInfo' is not concurrency-safe because non-'Sendable' type 'EntityInfo' may have shared mutable state
Static property 'entityBinding' is not concurrency-safe because non-'Sendable' type 'Recipe.EntityBindingType' (aka 'RecipeBinding') may have shared mutable state
As a workaround, a nonisolated(unsafe) helps for the time being.
/// Generated metadata used by ObjectBox to persist the entity.
nonisolated(unsafe)internalstaticvarentityInfo=ObjectBox.EntityInfo(name:"Recipe", id:1)nonisolated(unsafe)internalstaticvarentityBinding=EntityBindingType()
Is there an existing issue?
Build info
Steps to reproduce
Entity:
Generated code:
Compilation Errors:
Expected behavior
The generated code should be compilable.
Actual behavior
Compilation error
The text was updated successfully, but these errors were encountered: