Skip to content

Compiler crash when secondary constructor has 3 or more implicit parameters #20483

Closed
@kavedaa

Description

@kavedaa

Compiler version

3.4.1 and others

Minimized code

//> using scala 3.4.1

class Foo
  (x: Option[String])
  (using Boolean)
  (using Int)
  (using Double):

  def this
    (x: String)
    (using Boolean)
    (using Int)
    (using Double) =
    this(Some(x))

Output (click arrow to expand)

Error compiling project (Scala 3.4.1, JVM (8))
Error: Unexpected error when compiling secondary-constructor-implicit_a13f841420-2a4dfdb310: java.lang.AssertionError: assertion failed: missing implicit parameter of type Double after typer at phase parser
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1075)
        at dotty.tools.dotc.typer.Implicits.inferImplicit$(Implicits.scala:851)
        at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:120)
        at dotty.tools.dotc.typer.Implicits.inferImplicitArg(Implicits.scala:917)
        at dotty.tools.dotc.typer.Implicits.inferImplicitArg$(Implicits.scala:851)
        at dotty.tools.dotc.typer.Typer.inferImplicitArg(Typer.scala:120)
        at dotty.tools.dotc.typer.Typer.implicitArgs$1(Typer.scala:3815)
        at dotty.tools.dotc.typer.Typer.addImplicitArgs$1(Typer.scala:3851)
        at dotty.tools.dotc.typer.Typer.adaptNoArgsImplicitMethod$1(Typer.scala:3930)
        at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4130)
        at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4379)
        at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3677)

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