opal
opal copied to clipboard
Make PropertyKey generic in the Entity type
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).