Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed this to be u64 -- do you see something different when you run Noir programs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevaundray yes, even with 0.19.2, i get this error :
if i do something like this :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevaundray oh i see,
8
is of typefield
, this code works like this :if (i+j < 8 as u64) {...}
my bad!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, actually, the behaviour is odd, this compiles as well :
It seems one of the two operands needs to be converted to a uint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think thats possibly a separate issue -- I would have expected 8 to be automatically casted to a u64 without the explicit cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that
8
is automatically casted to au64
only if we explicitly declarei
andj
asu64
in the comparison.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you open an issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'll do it tomorrow in the morning as soon as i am available.
Should i close this PR as it is finally irrelevant ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be an ordering issue with two type constraints. IIRC
i
andj
are not actuallyu64
s, they just default tou64
if no other type is specified. The same is the case for the literal8
, although it defaults toField
instead.The important part is that internally we have a
TypeVariableKind::IntegerOrField
(for8
) but not a corresponding kind for just integer / u64. The delayed_type_check hack is used instead which is why this defaults to Field and is not caught. The fix for this is to remove the hack and have a dedicated type variable kind - so yes this should be a separate issue. This PR can be closed.