Closed
Description
dottyVersion = "0.27.0-RC1"
Please find 3 different verions and 2 different outputs here:
Minimized code
1:
class MaxSizeMap[K, V](maxSize: Int)(using o: Ordering[K]):
private val sortedMap: mutable.TreeMap[K, V] = mutable.TreeMap.empty[K, V](o)
export sortedMap._
2:
class MaxSizeMap[K, V](maxSize: Int)(using o: Ordering[K]):
val sortedMap: mutable.TreeMap[K, V] = mutable.TreeMap.empty[K, V](o)
export sortedMap._
3:
notice that all the methods I had to exclude to get rid of error messages from 1 return this.type
class MaxSizeMap[K, V](maxSize: Int)(using o: Ordering[K]):
private val sortedMap: mutable.TreeMap[K, V] = mutable.TreeMap.empty[K, V](o)
export sortedMap.{mapValuesInPlace => _, toIterable => _, seq => _, --= => _, ++= => _, += => _, addAll => _, subtractAll => _,
lazyZip => _, filterInPlace => _, -= => _, addOne => _, subtractOne => _, transform => _, retain => _, _}
Output
1:
[error] 8 | export sortedMap._
[error] | ^
[error] |non-private method += in class MaxSizeMap refers to private value sortedMap
[error] |in its type signature (elem1: (K, V), elem2: (K, V), elems: (K, V)*):
[error] | (MaxSizeMap.this.sortedMap : collection.mutable.TreeMap[K, V])
2 and 3 (same stack trace):
truncated stack trace:
[error] ## Exception when compiling 6 sources to /home/michal/programming/scala/crypto-db/target/scala-0.27/classes
[error] java.lang.AssertionError: assertion failed
[error] dotty.DottyPredef$.assertFail(DottyPredef.scala:16)
[error] dotty.tools.dotc.transform.ResolveSuper.transformDefDef(ResolveSuper.scala:63)
[error] dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:973)
[error] dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:974)
[error] dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
[error] dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:426)
[error] dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:436)
[error] dotty.tools.dotc.transform.MegaPhase.recur$3$$anonfun$1(MegaPhase.scala:441)
[error] dotty.tools.dotc.transform.MegaPhase$$Lambda$6255/00000000480AB540.apply(Unknown Source)
[error] scala.collection.immutable.List.mapConserve(List.scala:472)
Expectation
It compiles