fable-compiler / Fable.Python

Python bindings for Fable
https://fable.io/docs/
MIT License
135 stars 10 forks source link

DUs are not hashable #47

Closed thautwarm closed 2 years ago

thautwarm commented 2 years ago
fable_modules\fable_library\types.py", line 74, in __hash__
    return hash([hash(self.tag), *hashes])

We cannot hash a Python list as it is mutable. Tuples are hashable if and only if all the elements are hashable. Changing the code to return hash( (hash(self.tag), *hashes) ) will suffice.

I can make a PR soon later.

dbrattli commented 2 years ago

Yes, I just discovered the same with TypeInfo

dbrattli commented 2 years ago

Closing since this issue should be fixed

dbrattli commented 2 years ago

Closing since this issue should be fixed