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

Fix unknown compiler crash printing 'null' #780

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions effekt/shared/src/main/scala/effekt/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ trait Compiler[Executable] {
* - Server / Driver to typecheck and report type errors in VSCode
*/
def runFrontend(source: Source)(using C: Context): Option[Module] =
def getStackTrace(e: Throwable): String =
val stringWriter = new java.io.StringWriter()
e.printStackTrace(new java.io.PrintWriter(stringWriter))
stringWriter.toString
Comment on lines +118 to +121
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is essentially cherry-picked from the discussion in @JakubSchwenkbeck's #731. Thanks!


try {
val res = Frontend(source).map { res =>
val mod = res.mod
Expand All @@ -128,15 +133,11 @@ trait Compiler[Executable] {
None
case e @ CompilerPanic(msg) =>
C.report(msg)
e.getStackTrace.foreach { line =>
C.info(" at " + line)
}
C.info(getStackTrace(e))
None
case e =>
C.info("Effekt Compiler Crash: " + e.getMessage)
e.getStackTrace.foreach { line =>
C.info(" at " + line)
}
C.info("Effekt Compiler Crash: " + e.toString)
C.info(getStackTrace(e))
None
}

Expand Down
Loading