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
thanks to #6391, it's now possible to rename fields of inline records:
type t = Foo({ @as("renamed") name: string, age: int}) | Bar let foo = Foo({ name: "foo", age: 10 })
generates:
var foo = { TAG: "FOO", renamed: "foo", age: 10 }
But if you try to get the value then it bugs:
let getName = t => switch t { | Bar => "bar" | Foo({name}) => name }
function getName(t) { if (typeof t !== "object") { return "bar"; } else { return t.name; // the error is here, it should be t.renamed } }
The text was updated successfully, but these errors were encountered:
if you look at the patch that inspired @tatchi's, you can notice that it wasn't ported faithfully. Just a thought, but that might fix the issue.
melange-re/melange#732
EDIT: your example works in the melange playground, for example.
Sorry, something went wrong.
Looks like it's already fixed in the #6456
@as
No branches or pull requests
thanks to #6391, it's now possible to rename fields of inline records:
generates:
But if you try to get the value then it bugs:
generates:
The text was updated successfully, but these errors were encountered: