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

Calling Warning.set with badly typed argument crashes interpreter #11571

Closed
radeusgd opened this issue Nov 15, 2024 · 1 comment · Fixed by #11877
Closed

Calling Warning.set with badly typed argument crashes interpreter #11571

radeusgd opened this issue Nov 15, 2024 · 1 comment · Fixed by #11877
Assignees
Labels

Comments

@radeusgd
Copy link
Member

The following script:

from Standard.Base import all

main =
    c = Panic.catch Any (Warning.set 1 2) caught_panic-> IO.println caught_panic.payload
    IO.println c

Actual behaviour

crashes the interpreter with

Execution finished with an error: com.oracle.truffle.api.CompilerDirectives$ShouldNotReachHere
        at <java> org.graalvm.truffle/com.oracle.truffle.api.CompilerDirectives.shouldNotReachHere(CompilerDirectives.java:574)
        at <java> org.graalvm.truffle/com.oracle.truffle.api.CompilerDirectives.shouldNotReachHere(CompilerDirectives.java:546)
        at <java> org.enso.runtime/org.enso.interpreter.runtime.warning.SetWarningsNode.doSetInteropArray(SetWarningsNode.java:95)
        at <java> org.enso.runtime/org.enso.interpreter.runtime.warning.SetWarningsNodeGen.executeAndSpecialize(SetWarningsNodeGen.java:260)
        at <java> org.enso.runtime/org.enso.interpreter.runtime.warning.SetWarningsNodeGen.execute(SetWarningsNodeGen.java:122)
        at <java> org.enso.runtime/org.enso.interpreter.runtime.warning.SetWarningsMethodGen.execute(SetWarningsMethodGen.java:154)
        at <enso> Warning.set_array(Internal)
        at <enso> Warning.type.set(Warning.enso:94:26-49)
        at <enso> warning-set-crash.main<arg-2>(warning-set-crash.enso:4:26-40)
        at <enso> Panic.catch(Internal)
        at <enso> warning-set-crash.main(warning-set-crash.enso:4:9-88)

This cannot be caught with Panic.catch as demonstrated by the script.

Expected behaviour

This should fail, like any other function expecting a specific type (here a Vector), with a Type_Error panic that can be normally caught by Panic.catch.

@enso-bot
Copy link

enso-bot bot commented Dec 17, 2024

@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🟢 Accepted
Development

Successfully merging a pull request may close this issue.

2 participants