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

Report compiler crash #202

Closed
Tracked by #231
mlutze opened this issue Jun 2, 2022 · 12 comments · Fixed by #287
Closed
Tracked by #231

Report compiler crash #202

mlutze opened this issue Jun 2, 2022 · 12 comments · Fixed by #287
Assignees

Comments

@mlutze
Copy link
Member

mlutze commented Jun 2, 2022

No description provided.

@magnus-madsen
Copy link
Member

Here is a program that crashes Flix:


pub enum E with Eq, Order

it would be nice if VSCode could report that somehow.

@mR4smussen
Copy link
Contributor

I’m not completely sure how to crash the compiler. By using pub enum E with Eq, Order I can get the compiler to try to print an empty {} diagnostic, which gives an error and simply clears the console. I can check for this simply by checking that the diagnostic wasn’t an empty object !_.isEqual(result, {}) but then (since the console isn’t cleared) I get the error below. When I remove the line resulting in this error the compiler seems to work as before (didn’t crash)?

>> Undefined name 'pub'.

4 | /pub enum E with Eq, Order
     ^^^
     name not found


Explanation:
Tip: Possible typo or non-existent definition?
#
# An unexpected error has been detected by the Flix compiler:
#
#   head of empty list
#
# This is a bug in the Flix compiler. Please report it here:
#
# https://github.com/flix/flix/issues
#
# -- Flix Compiler --
#
# Flix Version : 0.34.0
#   incremental: All
#
# -- Java Virtual Machine --
#
# JVM Version  : 17.0.5 (2022-10-18)
# JVM Vendor   : Eclipse Adoptium
# JAVA_HOME    : C:\Program Files\Eclipse Adoptium\jdk-17.0.5.8-hotspot
# System       : Windows 10 (10.0)
#
# -- Stack Trace --
java.util.NoSuchElementException: head of empty list
	at scala.collection.immutable.Nil$.head(List.scala:629)
	at scala.collection.immutable.Nil$.head(List.scala:628)
	at ca.uwaterloo.flix.language.phase.unification.Unification$.unifyTypeM(Unification.scala:322)
        ... [more]

@magnus-madsen
Copy link
Member

@mlutze What do we actually want here? A pop-up or what?

@mlutze
Copy link
Member Author

mlutze commented Mar 14, 2023

Yes, I think a pop-up would be appropriate, as long as the stacktrace is printed somewhere.

@magnus-madsen
Copy link
Member

Does the language server return some error code?

@mR4smussen
Copy link
Contributor

Something like this? The stack trace is included in the crash report
image

@mlutze
Copy link
Member Author

mlutze commented Mar 14, 2023

Can the popup link to the crash report?

@mR4smussen
Copy link
Contributor

mR4smussen commented Mar 14, 2023

Does the language server return some error code?

I only think it returns it as a failure (https://github.com/flix/flix/blob/master/main/src/ca/uwaterloo/flix/api/lsp/LanguageServer.scala#L356-L357)

Can the popup link to the crash report?

I'll look into this.
Edit: I don't think this would be possible without returning more information from the compiler. The crash report is handled by the compiler, and I don't have access to anything regarding the name on the vscode side.

@magnus-madsen
Copy link
Member

magnus-madsen commented Jun 23, 2023

@sockmaster27 There is a lot of text above, but it is not too important. Here is the main task.

We currently return a JSON object with status = success or failure from the Flix compiler.

I would like to change this so that status can be one of three:

  • OK - as before, ALL OK
  • INVALID_REQUEST - corresponds to failure except in the crash case.
  • COMPILER_ERROR - corresponds to a compiler crash.

When a COMPILER_ERROR is encountered we should show a message like in #256

We probably want to introduce an enum in both the compiler and VSCode.

Does it make sense? This is not too high priority.

@sockmaster27
Copy link
Contributor

Here is a program that crashes Flix:


pub enum E with Eq, Order

it would be nice if VSCode could report that somehow.

This doesn't appear to work anymore. Is there something else I can use to test it?

@magnus-madsen
Copy link
Member

@mlutze @JonathanStarup Do we have any know program that crashes the compiler?

@sockmaster27
Maybe check out

https://github.com/flix/flix/issues?q=is%3Aissue+is%3Aopen+label%3Abug

@sockmaster27
Copy link
Contributor

Found one 👍

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

Successfully merging a pull request may close this issue.

4 participants