Fix kernel function parameters
This MR implements equality and hashing for PsSymbol
such that the parameters of KernelFunction
s are unique.
Also improves some error messages.
Merge request reports
Activity
requested review from @da15siwa
assigned to @he66coqe
Content-based equality and hashing for
PsSymbol
were not implemented intentionally to make sure that for every symbol, only one instance ever exists in the backend, and all symbol instances are known to and managed by theKernelCreationContext
.This is necessary so that changes to a symbol in one place (e.g. setting or updating the data type) are immediately reflected across the AST. If we allow multiple instances of
PsSymbol
to refer to the same object, thePsSymbol
cannot be mutable, and a lot of transformations become harder to implement.The
KernelCreationContext
acts as a symbol table; as long as you stick to using its interface (i.e.get_symbol
), you should never get symbol duplicates.