Fable: nagareyama rc-010 breaks elmish code

Created on 1 Dec 2020  路  6Comments  路  Source: fable-compiler/Fable

Description

Changing from rc-0009 to rc-0010 breaks one part of my program, which opens a popup. I realise this is very vague, i will add details when I have time, but for now will go back to rc-0009.

Repro code

Nothing simple, but:
https://github.com/tomcl/issie

build

open with new project, add a RAM (under memories) component. Select it, move to properties, open the memory editor popup

Expected and actual results

expected - popup with boxes to enter memory values

actual - error as below

2020-12-01 00_26_41-ISSIE

Related information

  • Fable version: nagareyama rc-0010
  • Operating system win 10

Most helpful comment

This breaks

div [bodyStyle] [
        Table.table [ Table.IsFullWidth ] [
            thead [] [ tr [] [
                th [] [str "Address"]
                th [] [str "Content"]
            ] ]
            tbody [] ( [startLoc..endLoc] |> List.map (makeRow memory.Data) )
        ]
    ]

This works

div [bodyStyle] [
        Table.table [ Table.IsFullWidth ] [
            thead [] [ tr [] [
                th [] [str "Address"]
                th [] [str "Content"]
            ] ]
            tbody [] ( [startLoc..endLoc] |> List.map (fun i -> (makeRow memory.Data i))
        ]
    ]

It may well be relevant that startLoc, endloc are uint64

All 6 comments

PS - this may just be that I am using elmish/react in some non-optimal way. Maybe I've got some js objects in my elmish view function output hiding somewhere? It is also possible that between the rc-0010 commit and the rc-0009 commit I have coincidentally got a new version of elmish etc. I realise I have not narrowed this down much, but thought I would post just in case it helped, because the only change in these two commits in my github tracked files is the compiler change. rc-0009 works, rc-0010 does not.

OK, I have a repro.

I've replaced the normal elmish view function by the code that crashes with rc-010. so even though this is a lot of code, very little of it actually runs.

https://github.com/tomcl/issie/tree/nagareyama-rc0010-bug

build (to build it)

actual: The error as above will be shown in dev tools (if you open them).
expected: a popup with some input boxes
.
You can change from the bug to no bug output simply by changing the version in dotnet-tools.json to rc-009 and rerunning the build.

Thanks for preparing the code @tomcl, this time I was able to run the app and reproduce the error. RC 10 contained improvements on beta reduction to output cleaner code, but maybe I made a mistake. Investigating.

This breaks

div [bodyStyle] [
        Table.table [ Table.IsFullWidth ] [
            thead [] [ tr [] [
                th [] [str "Address"]
                th [] [str "Content"]
            ] ]
            tbody [] ( [startLoc..endLoc] |> List.map (makeRow memory.Data) )
        ]
    ]

This works

div [bodyStyle] [
        Table.table [ Table.IsFullWidth ] [
            thead [] [ tr [] [
                th [] [str "Address"]
                th [] [str "Content"]
            ] ]
            tbody [] ( [startLoc..endLoc] |> List.map (fun i -> (makeRow memory.Data i))
        ]
    ]

It may well be relevant that startLoc, endloc are uint64

@alfonsogarciacaro see above (but you have probably worked it out!)

Thanks a lot @tomcl! That was super helpful to spot the problem 馃憦 馃憦 馃憦 It was actually an issue with the JS printer when spreading an expression. It could be that this was also related to some of the other issues you reported, hopefully the next release helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

funlambda picture funlambda  路  4Comments

MangelMaxime picture MangelMaxime  路  3Comments

rommsen picture rommsen  路  3Comments

forki picture forki  路  3Comments

ncave picture ncave  路  3Comments