Skip to content

Display error with full stack trace for crashed compiler #357

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
prolativ opened this issue Nov 8, 2021 · 9 comments · Fixed by #2557
Closed

Display error with full stack trace for crashed compiler #357

prolativ opened this issue Nov 8, 2021 · 9 comments · Fixed by #2557

Comments

@prolativ
Copy link

prolativ commented Nov 8, 2021

If the compiler crashes during compilation the full stack trace from the compiler (and maybe some additional clarification) should be displayed instead of the sole error message from the compiler's exception, which can be as vague as e.g. just assertion failed: <none>.
This is important for 2 main reasons:

  • It's not quite clear if the error means something is wrong with the user's code, the compiler or scala-cli itself
  • This would make reporting errors to the compiler easier and would encourage people to report bugs (we could also include some message explaining how to do that with a link to the proper repository etc.)

(Reported for scala-cli v0.0.7)

@lwronski lwronski self-assigned this Dec 7, 2021
@lwronski
Copy link
Contributor

lwronski commented Dec 7, 2021

It can be related to: scalameta/metals#3214

@romanowski
Copy link
Member

I think we should also expand this issue to all cases where the compiler prints information, e.g. when users want to print trees after certain phases. cc @KacperFKorban

@KacperFKorban
Copy link
Contributor

The three major use cases related to this issue are:

  • output from Scala 2 compiler e.g. -Xprint:typer (in Scala 3 this output goes through reporter, so it works)
  • output from macros
  • output from compiler plugins

@SethTisue
Copy link
Contributor

SethTisue commented Sep 21, 2022

Another use case is compiler crashes. With scala-cli compile I just get e.g.

exception occurred while compiling /Users/tisue/tmp/20220921/S.scala
Error compiling project (Scala 3.2.0, JVM)
Error: Unexpected error when compiling project_40de3a9abc_40de3a9abc: 'assertion failed: Bad superClass for class Integer: val <none>'
Compilation failed

whereas with 3.2.0's scalac I get the full stack trace — which I need, if I'm going to file a bug report, or attempt to investigate the crash myself.

@bblfish
Copy link

bblfish commented Oct 5, 2022

I get something similar running a 3 line program as described here: #1420 (comment)

@SethTisue
Copy link
Contributor

SethTisue commented Oct 31, 2023

Note (as @lwronski pointed out on #1420) that one can work around this with --server=false — I guess because it's bloop that's eating the additional output from the compiler.

This came up for me today in one of the scenarios already mentioned by @KacperFKorban : I am debugging a Scala 3 compiler plugin, and the debugging output from the plugin vanishes. --server=false makes the output appear as expected.

@SethTisue
Copy link
Contributor

Yay! Thank you!

@SethTisue
Copy link
Contributor

SethTisue commented Jan 24, 2024

I am debugging a Scala 3 compiler plugin, and the debugging output from the plugin vanishes. --server=false makes the output appear as expected.

This isn't fixed, but I guess it's part of #2530.

@SethTisue
Copy link
Contributor

SethTisue commented Mar 1, 2025

I am debugging a Scala 3 compiler plugin, and the debugging output from the plugin vanishes. --server=false makes the output appear as expected.

This isn't fixed, but I guess it's part of #2530.

It wasn't fixed as part of #2530 either.

I've opened #3529 on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants