Untagged variant detected as invalid after update to rc5

Today I tried to update rescript to 11.0.0-rc5 (previous version was rescript@11.0.0-beta.4).

But then, the compilation start failing in the code of a dependency (GitHub - cca-io/rescript-mui: ReScript bindings for MUI). I asked them to make a new release, because I noticed they updated to rc5 some days ago.

But I still get the following error:

$ node_modules/.bin/rescript -version
11.0.0-rc.5

$ node_modules/.bin/rescript
>>>> Start compiling
Different compiler version: clean current repo
Cleaning... 6 files.
Cleaning... 18 files.
Cleaning... 168 files.
Cleaning... 12 files.
Cleaning... 0 files.
Dependency on @kaiko.io/rescript-prelude
rescript: [3/3] src/Prelude.cmj
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-deser
rescript: [3/3] src/JSON.cmj
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-reindexed
rescript: [78/78] src/ReIndexed.cmj
rescript: [105/105] install.stamp
Dependency on @merchise/rescript-action-queue
rescript: [3/3] src/ActionQueue.cmj
rescript: [5/5] install.stamp
Dependency on @rescript/react
rescript: [55/55] src/v3/ReactV3.cmj
rescript: [71/71] install.stamp
Dependency on @rescript-mui/material
rescript: [257/415] src/components/Theme-Mui.cmj
FAILED: src/components/Theme-Mui.cmj

  We've found a bug for you!
  /home/manu/tmp/r11rc5-mui/node_modules/@rescript-mui/material/src/components/Theme.res:12:3-34

  10 │ type breakpoint =
  11 │   | Point(float)
  12 │   | Func(string => ThemeOptions.t)
  13 │ 
  14 │ type t_breakpoints = {

  This untagged variant definition is invalid: Case Func has a payload that is not of one of the recognized shapes (object, array, etc). Then it must be the only case with payloads.

rescript: [295/415] src/components/Zoom-Mui.cmj
FAILED: cannot make progress due to previous errors.
Failure: /home/manu/tmp/r11rc5-mui/node_modules/rescript/linux/ninja.exe 
Location: /home/manu/tmp/r11rc5-mui/node_modules/@rescript-mui/material/lib/bs

Strangely, I can compile the rescript-mui project without issues.

The same happens after clean:

$ node_modules/.bin/rescript clean
Cleaning... 5 files.
Cleaning... 5 files.
Cleaning... 130 files.
Cleaning... 5 files.
Cleaning... 80 files.
Cleaning... 328 files.
Cleaning... 0 files.


$ node_modules/.bin/rescript
>>>> Start compiling
Dependency on @kaiko.io/rescript-prelude
rescript: [3/3] src/Prelude.cmj
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-deser
rescript: [3/3] src/JSON.cmj
rescript: [5/5] install.stamp
Dependency on @kaiko.io/rescript-reindexed
rescript: [78/78] src/ReIndexed.cmj
rescript: [105/105] install.stamp
Dependency on @merchise/rescript-action-queue
rescript: [3/3] src/ActionQueue.cmj
rescript: [5/5] install.stamp
Dependency on @rescript/react
rescript: [55/55] src/v3/ReactV3.cmj
rescript: [71/71] install.stamp
Dependency on @rescript-mui/material
rescript: [256/415] src/components/Theme-Mui.cmj
FAILED: src/components/Theme-Mui.cmj

  We've found a bug for you!
  /home/manu/tmp/r11rc5-mui/node_modules/@rescript-mui/material/src/components/Theme.res:12:3-34

  10 │ type breakpoint =
  11 │   | Point(float)
  12 │   | Func(string => ThemeOptions.t)
  13 │ 
  14 │ type t_breakpoints = {

  This untagged variant definition is invalid: Case Func has a payload that is not of one of the recognized shapes (object, array, etc). Then it must be the only case with payloads.

rescript: [295/415] src/components/Fade-Mui.cmj
FAILED: cannot make progress due to previous errors.
Failure: /home/manu/tmp/r11rc5-mui/node_modules/rescript/linux/ninja.exe 
Location: /home/manu/tmp/r11rc5-mui/node_modules/@rescript-mui/material/lib/bs
>>>> Finish compiling (exit: 1)

I created this repository where you can see the issue: GitHub - mvaled/r11rc5-mui: Demonstrate an issue with rescript rc5 and mui.

I think it is already solved in master: Fix issue where curried function was not supported with untagged vari… by cristianoc · Pull Request #6478 · rescript-lang/rescript-compiler · GitHub

The fix is just not yet released. @cknitt I think we could afford another rc release?

1 Like

So, it works while compiling rescript-mui, because its rescript.json doesn’t have “uncurried” flag, which is now true by default. But in my project I use “uncurried: false” (and put @@uncurried in all modules) because some of my dependencies would not compile with “uncurried: true”.

The new version just dropped! Try it again, it should work now.

1 Like

Thanks. That error is gone, but now I’m getting another but it’s unrelated; so I will close this thread and start another one.

1 Like