Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust eq() to work properly with reserved primitive / elementary types #160

Open
blitz-1306 opened this issue Oct 20, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@blitz-1306
Copy link
Contributor

Description

Consider following case:

eq([types.bool, types.bool], [new BoolType(), new BoolType()])

It actually will return false. However it does not seem to be bug, as it is intended behavior.

Context

We can not reuse types (like types.bool and etc) in InferType.elementaryTypeNameStringToTypeNode() due to eq() will fail when comparing complex types. For example:

function () pure returns (bool, bool)

This is the result of eq()s way to handle recursion via visited cache map and store only one corresponding element.

We can reduce amount of allocations if we find a way fix eq()s behavior. However, we should also consider to not cause much allocations during eq(). One of the ways - do not cache primitive type nodes there.

@blitz-1306 blitz-1306 added the bug Something isn't working label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant