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

REPL doesn't report op= mutations #12894

Open
som-snytt opened this issue Oct 17, 2023 · 1 comment · May be fixed by scala/scala#10728
Open

REPL doesn't report op= mutations #12894

som-snytt opened this issue Oct 17, 2023 · 1 comment · May be fixed by scala/scala#10728

Comments

@som-snytt
Copy link

Reproduction steps

Scala version: 2.13

scala 2.13.12> var x = 42
var x: Int = 42

scala 2.13.12> x = 17
// mutated x

scala 2.13.12> x += 10

scala 2.13.12> x
val res1: Int = 27

Problem

It should say that x was mutated by assignment +=.

@SethTisue SethTisue added the repl label Oct 17, 2023
@SethTisue SethTisue added this to the Backlog milestone Jan 26, 2024
@SethTisue
Copy link
Member

SethTisue commented Jan 26, 2024

This would be a good little starter project for somebody, either in Scala 2 or Scala 3 or both.

In Scala 3 (3.4.0-RC3), instead of "mutated x" it actually shows the new value, which seems like a better design:

scala> var x = 42
var x: Int = 42
                                                                                                    
scala> x = 20
x: Int = 20

But Scala 3 also fails to handle += and friends the same way it handles plain assignment

scala> x += 10
                                                                                                    
scala> 

@som-snytt som-snytt linked a pull request Mar 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants