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

Add an option to copy positions from old tree when doing substitutions #107

Open
wants to merge 2 commits into
base: scala-2.13
Choose a base branch
from

Conversation

jad-hamza
Copy link
Contributor

No description provided.

@romac
Copy link
Member

romac commented Sep 17, 2019

Reminder: Revert epfl-lara/stainless@a2f2600 when this is released.

@samarion
Copy link
Member

I'm not sure this really makes sense as you'll only copy the position over for the top-level substituted expression and not its children.

What is your use case? Maybe it would make more sense to use a custom transformer?

@romac
Copy link
Member

romac commented Sep 20, 2019

I don’t know the specific use-/testcase Jad had in mind, but he indeed ended up using a custom transformer in epfl-lara/stainless@a2f2600 FYI

@jad-hamza
Copy link
Contributor Author

Right, I needed it so that we don't lose the positions when substituting a variable with a new variable

you'll only copy the position over for the top-level substituted expression and not its children

Yes that's true, it's a bit weird having it in the general case. Should we move replaceKeepPositions from epfl-lara/stainless@a2f2600 (bad naming sorry) to Inox? (And change the signature to only replace variables with variables?)

@vkuncak
Copy link
Contributor

vkuncak commented Apr 15, 2021

@jad-hamza , is this still relevant? Is it for error reporting of positions?

@jad-hamza
Copy link
Contributor Author

jad-hamza commented Apr 16, 2021

Yes it's useful when you're freshening variables to maintain positions. Normal substitution will substitute all variables (which are at different position) by just one instance of a variable (which has a single position).

Now that I look at my code again in Stainless, I wonder how it was supposed to work. The function is still replacing with one single instance, instead of cloning the variable.

Edit: we can close here and address this in Stainless if this function is not needed in Inox

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.

4 participants