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

Not able to compile in ReScript 11 #56

Open
FilipKittnar opened this issue Sep 7, 2023 · 7 comments
Open

Not able to compile in ReScript 11 #56

FilipKittnar opened this issue Sep 7, 2023 · 7 comments

Comments

@FilipKittnar
Copy link

What I have:

"rescript": "^11.0.0-beta.4",
"@greenlabs/ppx-spice": "^0.2.0",

Also, in bsconfig:

  "bs-dependencies": ["@greenlabs/ppx-spice"],
  "ppx-flags": ["@greenlabs/ppx-spice/ppx"],

When I add your basic example to any module:

@spice
type user = {
  id: int,
  nickname?: string,
}

I get this error:

FAILED: types/Types_Vehicle.cmj

  Warning number 4 (configured as error) 
  /home/ab01234/app/types/Types_Vehicle.res

  this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type Js_json.t.

FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)

I have no idea what to do about this and how to make it work.

@mununki
Copy link
Member

mununki commented Sep 7, 2023

Can you share the bsconfig? Are you using uncurried mode?

@FilipKittnar
Copy link
Author

Sure,

{
  "name": "pns-app",
  "jsx": {
    "version": 4,
    "mode": "automatic"
  },
  "bsc-flags": ["-bs-super-errors", "-open RescriptStruct"],
  "sources": [
    {
      "dir": "app",
      "subdirs": true
    },
    {
      "dir": "components",
      "subdirs": true
    },
    {
      "dir": "utils",
      "subdirs": true
    },
    {
      "dir": "bindings",
      "subdirs": true
    },
    {
      "dir": "types",
      "subdirs": true
    }
  ],
  "package-specs": [
    {
      "module": "es6",
      "in-source": true
    }
  ],
  "suffix": ".bs.js",
  "bs-dependencies": ["@rescript/react", "@glennsl/rescript-fetch", "@greenlabs/ppx-spice"],
  "ppx-flags": ["@greenlabs/ppx-spice/ppx"],
  "warnings": {
    "number": "+A-42-48",
    "error": "+A-3-44-102-103"
  },
  "reanalyze": {
    "analysis": ["dce", "exception", "termination"],
    "suppress": [],
    "unsuppress": []
  }
}

@FilipKittnar
Copy link
Author

And by the way, I cannot do this:

"ppx-flags": ["@greenlabs/ppx-spice/ppx", "-uncurried"],

That causes this with pretty much every module:

FAILED: app/about/Page_About.ast
sh: 0: Illegal option -r

We've found a bug for you!
/home/pc00123/development/renault/pns/app/app/about/Page_About.res

Error while running external preprocessor
Command line: -uncurried '/tmp/ppx1f3aebPage_About.res' '/tmp/ppxbf90dfPage_About.res'

rescript: [2/66] components/atoms/logo/Components_Atoms_Logo.ast

@mununki
Copy link
Member

mununki commented Sep 7, 2023

At a guess, it sounds like you're not able to use uncurried mode, so let me make it reproducible.

@FilipKittnar
Copy link
Author

BTW, I tried to turn off the uncurried mode:

"uncurried": false,

but I'm still getting:

FAILED: types/Types_Vehicle.cmj

  Warning number 4 (configured as error) 
  /home/pc00123/development/renault/pns/app/types/Types_Vehicle.res

  this pattern-matching is fragile.
It will remain exhaustive when constructors are added to type Js_json.t.

FAILED: cannot make progress due to previous errors.

@FilipKittnar
Copy link
Author

I figured it out!
I like to be a little bit more strict with my ReScript warnings and errors and this is a configuration I use on all my projects:

  "warnings": {
    "number": "+A-42-48",
    "error": "+A-3-44-102-103"
  },

So the reason is that your code contains warning 4.
I will tweak my configuration so that spice compiles for me, but I really like especially warning 4 to be marked as an error. What do you think? Do you plan to deal with this warning?

@mununki
Copy link
Member

mununki commented Sep 7, 2023

Not for now, but definitely worth checking out. Thanks for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants