Closed
Description
Compiler crashes on synthetic methods generation on value class with more that one parameter
class A(a:Int, b:Int) extends AnyVal
error while transforming (a: Int, b: Int) extends AnyVal() {
private[this] val a: Int
private[this] val b: Int
}
error while transforming @scala.annotation.internal.SourceFile("/home/dos65/projects/tmp/dotty_samples/3.scala") final class A(a: Int, b: Int)
extends
AnyVal() {
private[this] val a: Int
private[this] val b: Int
}
error while transforming package <empty> {
@scala.annotation.internal.SourceFile("/home/dos65/projects/tmp/dotty_samples/3.scala") final class A(a: Int, b: Int)
extends
AnyVal() {
private[this] val a: Int
private[this] val b: Int
}
final lazy module val A: A$ = new A$()
final module class A$() extends Object() { this: A.type =>}
}
exception occurred while compiling /home/dos65/projects/tmp/dotty_samples/3.scala
Exception in thread "main" java.lang.AssertionError: assertion failed
at scala.Predef$.assert(Predef.scala:151)
at dotty.tools.dotc.transform.SyntheticMethods.dotty$tools$dotc$transform$SyntheticMethods$$valueHashCodeBody$1(SyntheticMethods.scala:141)
at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticRHS$1$1.apply(SyntheticMethods.scala:87)
at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticRHS$1$1.apply(SyntheticMethods.scala:87)
at dotty.tools.dotc.ast.tpd$.polyDefDef(tpd.scala:200)
at dotty.tools.dotc.ast.tpd$.DefDef(tpd.scala:170)
at dotty.tools.dotc.transform.SyntheticMethods.syntheticDef$1(SyntheticMethods.scala:96)
at dotty.tools.dotc.transform.SyntheticMethods.dotty$tools$dotc$transform$SyntheticMethods$$syntheticDefIfMissing$1(SyntheticMethods.scala:70)
at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticMethods$1.apply(SyntheticMethods.scala:190)
at dotty.tools.dotc.transform.SyntheticMethods$$anonfun$syntheticMethods$1.apply(SyntheticMethods.scala:190)
at scala.collection.immutable.List.flatMap(List.scala:327)
at dotty.tools.dotc.transform.SyntheticMethods.syntheticMethods(SyntheticMethods.scala:190)
at dotty.tools.dotc.transform.SyntheticMethods.addSyntheticMethods(SyntheticMethods.scala:195)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:215)
at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1149)
at dotty.tools.dotc.transform.MacroTransform$Transformer.transform(MacroTransform.scala:55)
at dotty.tools.dotc.transform.PostTyper$PostTyperTransformer.transform(PostTyper.scala:242)
Currently value class checking is in RefChecks, should it be moved on Typer?
@smarter