Skip to content

feat: erased vars#26134

Draft
kasiaMarek wants to merge 3 commits into
scala:mainfrom
kasiaMarek:erased_vars
Draft

feat: erased vars#26134
kasiaMarek wants to merge 3 commits into
scala:mainfrom
kasiaMarek:erased_vars

Conversation

@kasiaMarek
Copy link
Copy Markdown
Member

Adds erased vars. For an erased var all rhs's of an assignment must be pure and the assignements are erased.

How much have you relied on LLM-based tools in this contribution?

Moderately. First version (manually adjusted) of typedAssign was generated.

How was the solution tested?

The are new test cases for compilation

@bishabosha
Copy link
Copy Markdown
Member

i am curious how it is useful to have this? can you ever inspect what value is stored there

@mbovel
Copy link
Copy Markdown
Member

mbovel commented May 26, 2026

i am curious how it is useful to have this? can you ever inspect what value is stored there

No, not in Scala directly. You can reason about the value of the var in Stainless though, that's our use-case.

@vkuncak
Copy link
Copy Markdown

vkuncak commented May 27, 2026

Actually, whenever you have a stateful object whose capabilities (but not identity) change over time, this would be necessary, right @odersky ?

@odersky
Copy link
Copy Markdown
Contributor

odersky commented May 27, 2026

The capability type checker is not flow sensitive, so var's would not help. We need to create objects with the union of all the capabilities they might hold during their lifetime.

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.

5 participants