You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@gafiatulin did come over a strange behaviour when constructing a class where the first argument used ticks and a special character and the second was the same up to the special character, for instance:
scala> case class A(`a-b`: Int, a: Int)
defined class A
scala> A(1, 2)
res0: A = A(1,1)
This applies to both class and case classes but not functions. From the decompiled code below you can see that it does assign the second variable to the wrong value. If the values isn't compatible you will get a runtime error.
public class B {
private final int a$minusb;
private final int a;
public String toString() {
return new StringContext((Seq)Predef$.MODULE$.wrapRefArray((Object[])new String[]{"", " ", ""})).s((Seq)Predef$.MODULE$.genericWrapArray((Object)new Object[]{BoxesRunTime.boxToInteger((int)this.a$minusb), BoxesRunTime.boxToInteger((int)this.a)}));
}
public B(int a$minusb, int a) {
this.a$minusb = a$minusb;
this.a = a$minusb;
}
}
The text was updated successfully, but these errors were encountered:
@gafiatulin did come over a strange behaviour when constructing a class where the first argument used ticks and a special character and the second was the same up to the special character, for instance:
This applies to both class and case classes but not functions. From the decompiled code below you can see that it does assign the second variable to the wrong value. If the values isn't compatible you will get a runtime error.
class B(`a-b`: Int, a: Int){ override def toString = s"${`a-b`} $a"}
decompiles to:
The text was updated successfully, but these errors were encountered: