Closed Atry closed 2 years ago
Now, as in using the HEAD of master, this causes a Cyclic Error:
-- [E045] Cyclic Error: tests/pos/i14152.scala:2:2 -----------------------------
2 | object O1 extends AnyRef
| ^
| Recursive value aa1 needs type
longer explanation available when compiling with `-explain`
exception occurred while typechecking tests/pos/i14152.scala
exception occurred while compiling tests/pos/i14152.scala
java.lang.AssertionError: assertion failed: leak: O1 in {
val O1: O1 = new O1()
final module class O1() extends AnyRef() { this: O1.type =>}
Array.apply[Array[O1.type]](
[
Array.apply[O1.type]([O1 : O1.type]*)(
scala.reflect.ClassTag.apply[O1.type](classOf[O1])
)
: Array[O1.type]]*
)(scala.reflect.ClassTag.apply[O1.type](classOf[O1]).wrap):
Array[Array[O1.type]]
} while compiling tests/pos/i14152.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: leak: O1 in {
val O1: O1 = new O1()
final module class O1() extends AnyRef() { this: O1.type =>}
Array.apply[Array[O1.type]](
[
Array.apply[O1.type]([O1 : O1.type]*)(
scala.reflect.ClassTag.apply[O1.type](classOf[O1])
)
: Array[O1.type]]*
)(scala.reflect.ClassTag.apply[O1.type](classOf[O1]).wrap):
Array[Array[O1.type]]
}
Compiler version
3.1.0
Minimized code
https://scastie.scala-lang.org/8WGftp2KTAmmjTZdIqZduw
Output
Expectation
It should compile.
Note that the same code compiles in Scala 2 with warnings https://scastie.scala-lang.org/QDjOfT5RTleWMtlhRot12A
Workaround
The following code compiles: