Open
Description
We are working on an experiment feature based on Recheck
. During our testing on community projects, we have observed some unusual typing behaviors that we believe are caused by a bug in Recheck
.
Compiler version
3.3.1-RC1-bin-SNAPSHOT-nonbootstrapped-git-c1809bc
Minimized code
I couldn't minimize the code that triggers the issue. Here is the instruction on how to reproduce the error:
- enable
-Yrecheck-test
infansi
, by addingdef scalacOptions = Seq("-Yrecheck-test")
tobuild.sc
(to bothFansiMainModule
andFansiTestModule
) - run
community-build/testOnly -- *fansi
Output
[error] -- [E007] Type Mismatch Error: dotty/community-build/community-projects/fansi/fansi/test/src/fansi/FansiTests.scala:28:14
[error] 28 | val r = fansi.Str(rgbOps).render
[error] | ^^^^^^^^^
[error] | Found: fansi.Str.apply$default$2.type
[error] | Required: fansi.ErrorMode
It seems the default argument is not found on class fansi.Str
, so we get NoType
from fansi.Str.apply$default$2
.
The code of fansi.Str
looks like:
class Str private(private val chars: Array[Char], private val colors: Array[Str.State]) {
...
}
object Str {
def apply(raw: CharSequence, errorMode: ErrorMode = ErrorMode.Throw): fansi.Str = {
...
}
...
}
and the place causing the error:
val rgbOps = s"+++$R---$G***$B///"
...
val r = fansi.Str(rgbOps).render // error