enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 323 forks source link

Invalid arguments from lambda in collapsed node. #9412

Closed farmaazon closed 6 months ago

farmaazon commented 6 months ago

To reproduce: open the following project:

from Standard.Base import all
from Standard.Table import all
from Standard.Database import all
from Standard.AWS import all
import Standard.Visualization

main =
    operator13208 = enso_project.data/'3686412302.json' . read
    operator80502 = operator13208.get 'bench_run'
    operator42039 = operator80502.get 'id'
    operator9135 = operator80502.get "head_commit" . get "id"
    operator98772 = operator80502.get "head_commit" . get 'timestamp'
    operator27003 = operator80502.get "head_commit" . get 'message'
    operator84402 = operator80502.get "head_commit" . get 'author'
    operator59298 = operator98772.parse_date_time
    operator23880 = [operator42039, operator9135, operator59298, operator27003, operator84402]
    operator96032 = Table.from_rows ["Run ID", "Commit ID", "Date", "Commit Title", "Commit Author"] rows=[operator23880]
    operator95321 = operator13208.get 'label_score_dict'
    operator76512 = operator95321.map_with_key key->val->[key, val]
    operator97928 = Table.from_rows ['Label', 'Score'] operator76512
    operator75059 = operator96032.cross_join operator97928
    operator32822 = operator75059.reorder_columns ['Run ID', 'Label', 'Score'] Position.Before_Other_Columns

and collapse all nodes except the first one. Likely it might be reduced.

Expecting collapse function with single argument.

But instead, we get two operator13208 what is already reported (#9159) but also additional key and val parameters. Those names appear only in lambda, and are not names used outside.

AdRiley commented 6 months ago

I think this is the same defect

from Standard.Base import all
from Standard.Table import all
from Standard.Database import all
from Standard.AWS import all
import Standard.Visualization

main =
    operator86947 = [1,2,3]
    operator20382 = operator86947.map (x -> x+1)

and try to collapse the map node