opal icon indicating copy to clipboard operation
opal copied to clipboard

Make PropertyKey generic in the Entity type

Open errt opened this issue 8 months ago • 0 comments

Currently, any kind of entity can be associated with any property(key). This has drawbacks:

  • it is easy to accidentally either produce an EPS with an incorrect entity or, upon querying an EPS, try to match it against an incorrect entity kind without the type system showing the error
  • if the entity kind associated with a property changes (e.g., entities for escape analyses changed to be context sensitive), both analyses and clients need to be updated, but the type system does not offer any help

Thus, I propose we introduce a type parameter to PropertyKey to specify the entity type. Most properties are only sensible with a single type of entity anyway, and the ones where this is not the case can still opt for Any (or use union types in Scala 3).

errt avatar Jul 08 '25 15:07 errt