enso-org / enso

Hybrid visual and textual functional programming.
https://ensoanalytics.com
Apache License 2.0
7.36k stars 324 forks source link

Uncaught `null` in Chrome Inspector #6270

Closed radeusgd closed 1 year ago

radeusgd commented 1 year ago

I was able to get an error in the Chrome Inspector REPL when debugging an Enso script.

The repro is following:

Run the following script (I called it too-many-warnings.enso) with the --inspect option:

from Standard.Base import all
from Standard.Table import Table, Value_Type
from Standard.Database import Database, SQLite, In_Memory

main =
    c = Database.connect (SQLite In_Memory)
    t0 = Table.new [["X", ["a", "bc", "def"]]]
    t1 = c.upload_table "Tabela" t0
    t2 = t1.cast "X" (Value_Type.Char size=1)
    t2.print
    warnings = Warning.get_all t2 . map .value
    IO.println warnings.length
    IO.println warnings.first
    IO.println warnings.distinct.length

Set a breakpoint at line 10: t2.print and run up to this line.

When in this line, observe the following interaction in the REPL:

> t1.at "X" . value_type
  <- Value_Type (Char Nothing True)
> t2.at "X" . value_type
  <- Uncaught null
    at too-many-warnings.main (Unknown)
image
radeusgd commented 1 year ago

This does not work if I just Warning.attach a warning and try to call methods on it. Something more subtle is going on here, and I don't know what exactly.

I won't be surprised if this is related to #6258.

radeusgd commented 1 year ago

Confirmed can still reproduce as of today.

Just small modifications to the repro code needed to update to changes:

from Standard.Base import all
from Standard.Table import Table, Value_Type
from Standard.Database import Database, SQLite, In_Memory

main =
    c = Database.connect (SQLite In_Memory)
    t0 = Table.new [["X", ["a", "bc", "def"]]]
    t1 = t0.select_into_database_table c "Table1"
    t2 = t1.cast "X" (Value_Type.Char size=1)
    t2.print
    warnings = Warning.get_all t2 . map .value
    IO.println warnings.length
    IO.println warnings.first
    IO.println warnings.distinct.length

yielding: image

JaroslavTulach commented 1 year ago

I am getting following error when I try to execute the snippet:

Execution finished with an error: Method `upload_table` of type SQLite_Connection could not be found.
        at <enso> w.main(w.enso:8:10-35)

I am using 2023.2.1-nightly.2023.8.8.

radeusgd commented 1 year ago

I am getting following error when I try to execute the snippet:

Execution finished with an error: Method `upload_table` of type SQLite_Connection could not be found.
        at <enso> w.main(w.enso:8:10-35)

I am using 2023.2.1-nightly.2023.8.8.

Right, I somehow pasted the wrong (old) snippet, I don't know how I mixed them up. Updated with up-to-date snippet (upload_table was obsoleted and replaced by select_into_database_table).

JaroslavTulach commented 1 year ago

Yesterday I was able to reproduce the problem. Today I upgraded to 59329bd59aeacc4f60ccc4ef323dfaf6629c7710 and it seems to be working fine:

image

Given there are just three fixes in between

$ git log 2023.2.1-nightly.2023.8.8...59329bd59aeacc4f60ccc4ef323dfaf6629c7710
commit 59329bd59aeacc4f60ccc4ef323dfaf6629c7710 (HEAD -> develop, origin/develop, origin/HEAD)
    New Top Bar
commit b656b336c7d239ef95a548f87deb5af2f4801368
Author: Radosław Waśko <radoslaw.wasko@enso.org>
    Report `Loss_Of_Integer_Precision` when an integer is not exactly representable as a float during conversion
commit 05e8aade1f5586f011b4943ba9fb4fa221405a56
Author: Jaroslav Tulach <jaroslav.tulach@enso.org>
Date:   Tue Aug 8 11:18:38 2023 +0200
    Exclusive context policy ensures EnsoContext.get returns compilation constant (#7493)

and most of #7493 actually focuses on fixing getRootNode() for many @ExportedLibrary nodes. I'd say this issue is fixed by a collateral goodness of #7493.

radeusgd commented 1 year ago

I'd say this issue is fixed by a collateral goodness of #7493.

Awesome 🎉 and thanks for checking!

enso-bot[bot] commented 1 year ago

Jaroslav Tulach reports a new STANDUP for yesterday (2023-08-09):

Progress: - Fixed NPE while debugging: https://github.com/enso-org/enso/issues/6270

Next Day: Python interop & bugfixes

Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.