We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://rescript-lang.org/try?version=v12.0.0-alpha.10&module=esmodule&code=C4TwDgpgBMCGDmUC8UBCB7dAbCsB2UAPlAHICuAtgEYQBOAUKJFAGbq0WzDJQCSewAMwAmeo3DQAzgGMAFhE48A3vShRp6PJOAB+AFxQqmLABpVrdp10G2HLmbVx4Bp2YC+YnN1oQWASzxoFBl5RSQAPigVNUkAdz9gOSgQhVgo82IlDS1gAwB9N2RIgCJijKjbKwN+IWFCiKhigNqytUynAwxsXDx6kqNu-FaiKDyixoATX1gyLGBhjw8gA
v12 (broken):
function refine(schema) { if (schema.const !== undefined) { return ""; } else { return "int32"; } }
v11 (working):
function refine(schema) { if (schema.const !== undefined) { return ""; } else if (schema.format !== undefined) { return "int32"; } else if (schema.tag === "Boolean") { return "boolean"; } else { return "default"; } }
The text was updated successfully, but these errors were encountered:
Broken between alpha.4 and alpha.5
Sorry, something went wrong.
This seems to happen when variant format has only one case, and that single case Int32 is used as a case in the pattern matching.
format
Int32
type tag = Boolean | Number type format = Int32 type schema = { const?: bool, format?: format, tag: tag, } let refine = schema => { switch schema { | {const: _} => "" | {format: Int32} => "int32" | {tag: Boolean} => "boolean" | _ => "default" } }
Here's a simplified example, showing that using the explicit single value triggers the issue:
type format = Int32 type schema = { format?: format, } let bad = schema => { switch schema { | {format: Int32} => "int32" | _ => "default" } } let good = schema => { switch schema { | {format: _} => "int32" | _ => "default" } }
compiles to:
function bad(schema) { return "int32"; } function good(schema) { if (schema.format !== undefined) { return "int32"; } else { return "default"; } }
No branches or pull requests
https://rescript-lang.org/try?version=v12.0.0-alpha.10&module=esmodule&code=C4TwDgpgBMCGDmUC8UBCB7dAbCsB2UAPlAHICuAtgEYQBOAUKJFAGbq0WzDJQCSewAMwAmeo3DQAzgGMAFhE48A3vShRp6PJOAB+AFxQqmLABpVrdp10G2HLmbVx4Bp2YC+YnN1oQWASzxoFBl5RSQAPigVNUkAdz9gOSgQhVgo82IlDS1gAwB9N2RIgCJijKjbKwN+IWFCiKhigNqytUynAwxsXDx6kqNu-FaiKDyixoATX1gyLGBhjw8gA
v12 (broken):
v11 (working):
The text was updated successfully, but these errors were encountered: