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

No nesting inside RangeToken.StartToken #5976

Merged

Conversation

keyboardDrummer
Copy link
Member

@keyboardDrummer keyboardDrummer commented Dec 12, 2024

What was changed?

  • Replace wrapping RangeToken.StartToken with wrapping the entire RangeToken. This means:

    • Many functions that only took a RangeToken before must now take an IOrigin instead, to also accept wrapped RangeTokens
    • Since the constructor of RangeToken now only takes Token values, locations that constructed RangeTokens had to be updated to use the correct type.
    • Locations that checked for X is RangeToken now check the virtual method X.IncludesRange. This has the side-effect that error reporting more often detects that a range is available, so it reports "Could not prove <printed expression>" instead of "this proposition could not be proved"
  • Let NonglobalVariable and its subclasses (Formal and BoundVar) carry a Name instead of a string, so it's clear what the IOrigin is that contains the name.

  • Replace RefinementOrigin.IsInherited, which did unwrapping of tokens to find a RefinementToken, with a virtual method IsInherited.

How has this been tested?

  • There are a handful of small changes to expected files. I have inspected each one and they're all improvements.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@keyboardDrummer keyboardDrummer enabled auto-merge (squash) December 12, 2024 10:14
@keyboardDrummer keyboardDrummer changed the title No nesting inside range token No nesting inside RangeToken.StartToken Dec 12, 2024
Copy link
Contributor

@ssomayyajula ssomayyajula left a comment

Choose a reason for hiding this comment

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

I understand the RangeToken -> IOrigin generally, but why IOrigin -> Token in some places (e.g., ApplyExpr.cs)? Is that because you are expecting to construct a RangeToken and need a Token as an argument?

Thanks for making the other refactors!

@keyboardDrummer
Copy link
Member Author

keyboardDrummer commented Dec 13, 2024

I understand the RangeToken -> IOrigin generally, but why IOrigin -> Token in some places (e.g., ApplyExpr.cs)? Is that because you are expecting to construct a RangeToken and need a Token as an argument?

That is correct.

@keyboardDrummer keyboardDrummer merged commit 707ac0e into dafny-lang:master Dec 13, 2024
22 checks passed
@keyboardDrummer keyboardDrummer deleted the noNestingInsideRangeToken branch December 13, 2024 19:28
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.

2 participants