Rename refactoring is broken in case the renamed method has default arguments
object X extends App {
O().test.meth()
}
class C {
def meth(j: Int = 0) = j
}
class O {
def test: C = ???
}
object O {
def apply(): O = ???
}
Renaming test to test2 results in:
object X extends App {
Otest2.meth()
}
class C {
def meth(j: Int = 0) = j
}
class O {
def test2: C = ???
}
object O {
def apply(): O = ???
}
The call to test2 is broken.
If meth is renamed instead, the following is the result:
object X extends App {
O().meth2()
}
class C {
def meth2(j: Int = 0) = j
}
class O {
def test: C = ???
}
object O {
def apply(): O = ???
}
Now, test is completely removed.
Leave a comment
Here is another example that results in rather obscure behaviour: Renaming
renameMe
to ohNo
inobject Bug {
class Class {
def renameMe(i: Int = 42) = i
}
def c = new Class
c.renameMe()
}
generatesobject Bug {
class Class {
def ohNo(i: Int = 42) = i
}
def c = new Class
ohNo()
}
Interestingly this bug disappears if def c
is replaced by val c
.
Fix two problems with printing trees related to default arguments
Fixes #1002564
Branch: master
Commit: scala-ide:de8f4ff43e
Fixes #1002564
Branch: master
Commit: scala-ide:de8f4ff43e
Consider exotic but legal places for comments and spaces
This commit fixes a workaround that eventually makes sure that parenthesis
and dots are printed out in `Selects` involving default arguments.
See #1002611 and #1002564 as well as
[PR #112](https://github.com/scala-ide/scala-refactoring/pull/112#discussion_r46948682)
for further details.
Fixes #1002611 together with the last commit
Branch: master
Commit: scala-ide:326c47fa77
This commit fixes a workaround that eventually makes sure that parenthesis
and dots are printed out in `Selects` involving default arguments.
See #1002611 and #1002564 as well as
[PR #112](https://github.com/scala-ide/scala-refactoring/pull/112#discussion_r46948682)
for further details.
Fixes #1002611 together with the last commit
Branch: master
Commit: scala-ide:326c47fa77