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

Runtime crash: Function cannot be cast DataflowError #11774

Closed
JaroslavTulach opened this issue Dec 5, 2024 · 1 comment · Fixed by #12033
Closed

Runtime crash: Function cannot be cast DataflowError #11774

JaroslavTulach opened this issue Dec 5, 2024 · 1 comment · Fixed by #12033
Assignees
Labels
--data corruption or loss Important: data corruption or loss -compiler p-high Should be completed in the next sprint

Comments

@JaroslavTulach
Copy link
Member

While trying to simulate https://github.com/enso-org/enso/pull/11673/files/a041045046c7ab0dded3e1920649fa357ecfe5b3#r1870576716 I wrote following ref.enso program:

from Standard.Base import all

import Standard.Base.Runtime.Ref.Ref

from Standard.Base.IO import println

main =
    r = Ref.new 0
    println r
    Error.catch Any (Error.throw "No longer valid") err->
        println err
        ref.put err
    println r

it crashes the engine with:

Execution finished with an error: java.lang.ClassCastException: class org.enso.interpreter.runtime.callable.function.Function cannot be cast to class org.enso.interpreter.runtime.error.DataflowError (org.enso.interpreter.runtime.callable.function.Function and org.enso.interpreter.runtime.error.DataflowError are in module org.enso.runtime of loader 'app')
        at <java> org.enso.runtime/org.enso.interpreter.runtime.type.TypesGen.asDataflowError(TypesGen.java:180)
        at <java> org.enso.runtime/org.enso.interpreter.node.expression.builtin.error.CatchErrorMethodGen.execute(CatchErrorMethodGen.java:116)
        at <enso> Error.catch_primitive(Internal)
        at <enso> ref.main(ref.enso:10-12)
@JaroslavTulach JaroslavTulach added p-high Should be completed in the next sprint -compiler --data corruption or loss Important: data corruption or loss labels Dec 5, 2024
@github-project-automation github-project-automation bot moved this to ❓New in Issues Board Dec 5, 2024
@JaroslavTulach JaroslavTulach moved this from ❓New to 📤 Backlog in Issues Board Jan 7, 2025
@Akirathan
Copy link
Member

Akirathan commented Jan 10, 2025

Minimal reproducer:

from Standard.Base import all

main =
    Error.catch Any (Error.throw "No longer valid") x->x

Function calls:

  • Error.catch Any (Error.throw "No longer valid") x->x
  • (Any.catch self=Error error_type=Any handler=(Error.throw "No longer valid")) x->x
  • (Error.catch_primitive self=(y->y)) x->x
    • Here, y->y is actually reference to a function Any.type.catch.Any.type.catch[Any.enso:374-377] and there is another synthetic self argument with value Error.

In other words, the actual minimal reproducer is:

(Error.catch_primitive self=(y->y)) (x->x)

@Akirathan Akirathan moved this from 📤 Backlog to ⚙️ Design in Issues Board Jan 13, 2025
@Akirathan Akirathan moved this from ⚙️ Design to 👁️ Code review in Issues Board Jan 13, 2025
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--data corruption or loss Important: data corruption or loss -compiler p-high Should be completed in the next sprint
Projects
Status: 🟢 Accepted
Development

Successfully merging a pull request may close this issue.

2 participants