Skip to content

java.lang.StackOverflowError during phase 'typer' #7131

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

Closed
scabug opened this issue Feb 15, 2013 · 2 comments
Closed

java.lang.StackOverflowError during phase 'typer' #7131

scabug opened this issue Feb 15, 2013 · 2 comments

Comments

@scabug
Copy link

scabug commented Feb 15, 2013

The compiler crashes with a StackOverflowError during the type-checking phase.

I have attached the source file which causes the crash as well as the output messages emitted by the IDE (IntelliJ) which contains the stacktrace and the details of the error.

The offending bit appears to be the contravariance annotation on the type parameter T for the ObservableTrait. If the annotation is removed or replaced with '+' then the program just doesn't compile which I believe is the right behavior.

@scabug
Copy link
Author

scabug commented Feb 15, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7131?orig=1
Reporter: Marius-Andrei Danila (mdanila)
Affected Versions: 2.10.0
Attachments:

  • Main.scala (created on Feb 15, 2013 2:05:50 AM UTC, 2198 bytes)
  • Output.txt (created on Feb 15, 2013 2:05:50 AM UTC, 79589 bytes)

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@diesalbla
Copy link

diesalbla commented Nov 16, 2018

The code in the Main.scala file no longer crashes the compiler, as tested with 2.12.7 and current 2.13.x development version. .

In the 2.13.x, the compiler outputs the following type error:

t7131.scala:27: error: type mismatch;
 found   : Iterable[U]
 required: That
 Note: implicit method convertToSimpleMappable is not applicable here because it comes after the application point and it lacks an explicit result type
        x.value.map(f)
                   ^
one error found

However, when checking this code in Scala 2.12.7, it gets a different error message:

t7131.scala:5: error: contravariant type T occurs in covariant position in type => T of method value
  def value: T
      ^
one error found

It should be noted that Scala 2.13.x, inside the sbt scala command, rejects the definition of the ObservableValue trait itself, with the same error as the 2.12.8 version.

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