Skip to content

Compilation hangs when trying to resolve a context function with multiple implicit parameters #10605

Closed
@neko-kai

Description

@neko-kai

Minimized code

object x { 
  def xa[a, b, c, X, Y](
    f: X => ((a, b, c) ?=> Y),
    x: Any, 
    y: Any
  ) = { 
    println(f(y.asInstanceOf)(using x.asInstanceOf, x.asInstanceOf, x.asInstanceOf))
    (x: X) => (a: a, b: b, c: c) => f(x)(using a, b, c)
  }
}

def superxa(using String, Int, Option[Boolean]): Nothing = {
  implicitly[String] + implicitly[Int] + implicitly[Option[Boolean]] 
  ???
}

@main def main = 
  x.xa(Function.const(superxa)(_: Int), Nil, 5) // this line causes hang

https://scastie.scala-lang.org/G4oNvGFESFa3yyXkn5ICgg

Output

scalac superxa.scala
> // never returns

/

timed out after 30 seconds when running code

Expectation

Expected to work

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions