Skip to content

The default arguments are not found during rechecking #17012

Open
@noti0na1

Description

@noti0na1

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:

  1. enable -Yrecheck-test in fansi, by adding def scalacOptions = Seq("-Yrecheck-test") to build.sc (to both FansiMainModule and FansiTestModule)
  2. 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

cc: @e45lee @olhotak

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions