Skip to content

ReScript v12 - pattern matching on optional fields breaks other cases #7400

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

Open
DZakh opened this issue Apr 21, 2025 · 1 comment
Open

ReScript v12 - pattern matching on optional fields breaks other cases #7400

DZakh opened this issue Apr 21, 2025 · 1 comment

Comments

@DZakh
Copy link
Member

DZakh commented Apr 21, 2025

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";
  }
}
@DZakh
Copy link
Member Author

DZakh commented Apr 21, 2025

Broken between alpha.4 and alpha.5

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

1 participant