Skip to content

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

Closed
@radeusgd

Description

@radeusgd

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.

Metadata

Metadata

Type

No type

Projects

Status

🟢 Accepted

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions