Skip to content

crash on compilable code: Exception in thread "main" scala.MatchError: ContextBounds ... #1765

Closed
@helloqirun

Description

@helloqirun

scalac compiles but dotc crashes.

$ cat abc.scala

trait T[X]
trait U[X]
trait TC[M[_]] {
  def foo[M[_]: TC, A](ma: U[A]) = ()
  implicit val TCofT: TC[T] = new TC[T] {}
  implicit def any2T[A](a: A): T[A] = new T[A] {}
  implicit def any2U[A](a: A): U[A] = new U[A] {}
  val x = foo[T, Int](1)
  val y = ()
}

$ dotc abc.scala

exception occurred while typechecking abc.scala

exception occurred while compiling abc.scala
Exception in thread "main" scala.MatchError: ContextBounds(TypeBoundsTree(EmptyTree,EmptyTree),List(AppliedTypeTree(Ident(TC),List(Ident(M))))) (of class dotty.tools.dotc.ast.untpd$ContextBounds)
	at dotty.tools.dotc.ast.desugar$.apply(Desugar.scala:906)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1489)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1495)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1505)
	at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1503)
	at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:136)
	at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:57)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1503)
<snipped>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions