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

Check inferred type against ascription in variable declaration #935

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

megatron00999
Copy link
Contributor

@megatron00999 megatron00999 commented Nov 11, 2023

Fixes #915

Code such as below now throws UnexpectedType exception.

val price: Long  = ((reserveIn.toBigInt * precisionFactor) / hodlCoinsCircIn)

Copy link
Contributor Author

@megatron00999 megatron00999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks far bigger than what it actually is because of the indentation change which I had to do as part of doing the type validation at the end.

I've highlighted the main logical changes as comments. Rest is just indentation.

sc/shared/src/main/scala/sigmastate/lang/SigmaTyper.scala Outdated Show resolved Hide resolved
@megatron00999
Copy link
Contributor Author

@aslesarenko @kushti Please review.

@aslesarenko
Copy link
Member

@megatron00999 please rollback indentation so that I can review and analyze the changes. Then once approved, you can add identation back as separate commit.

@megatron00999
Copy link
Contributor Author

@aslesarenko Done, please take a look.

@ergoplatform ergoplatform deleted a comment from megatron00999 Nov 12, 2023
@aslesarenko
Copy link
Member

@megatron00999, please look at the failing tests.
It seems the check cannot be done as part of typing transformation.
It should be done as separate whole tree traverse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inferred type is not checked agains ascription
2 participants