Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on compilable code: StackOverflowError #3627

Closed
helloqirun opened this issue Dec 3, 2017 · 1 comment
Closed

crash on compilable code: StackOverflowError #3627

helloqirun opened this issue Dec 3, 2017 · 1 comment

Comments

@helloqirun
Copy link

scalac compiles but dotc crashes.

$ dotc -version

Dotty compiler version 0.5.0-bin-SNAPSHOT-git-4fefb64 -- Copyright 2002-2017, LAMP/EPFL

$ dotc abc.scala

-- [E018] Syntax Error: abc.scala:2:25 -----------------------------------------
2 |  def compare(a: T, b: T)
  |                         ^
  |                         missing return type

longer explanation available when compiling with `-explain`
Exception in thread "main" java.lang.StackOverflowError
	at dotty.tools.dotc.typer.ProtoTypes$.wildApprox(ProtoTypes.scala:478)
	at dotty.tools.dotc.typer.ProtoTypes$WildApproxMap.apply(ProtoTypes.scala:551)
	at dotty.tools.dotc.core.Types$TypeMap.op$3(Types.scala:3879)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3879)
	at dotty.tools.dotc.typer.ProtoTypes$.wildApprox(ProtoTypes.scala:545)
	at dotty.tools.dotc.typer.ProtoTypes$WildApproxMap.apply(ProtoTypes.scala:551)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3855)
	at dotty.tools.dotc.typer.ProtoTypes$.wildApprox(ProtoTypes.scala:545)
<snipped>

$ cat abc.scala

trait Comparinator[T] {
  def compare(a: T, b: T)
  def sort[T](x: Comparinator[_ >: T]) = ()
  sort((a: String, b: String) => a compareToIgnoreCase (b))
}
@allanrenucci
Copy link
Contributor

Minimised:

trait Comparinator[T] {
  def sort[T](x: Comparinator[_ >: T]) = ()
  sort((a: Int) => true)
}

@odersky odersky self-assigned this Jan 27, 2018
@odersky odersky closed this as completed in 3ca1171 Feb 2, 2018
odersky added a commit to dotty-staging/dotty that referenced this issue Feb 3, 2018
The fix of scala#3627 got lost when merging the GADT subtype changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants