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

Anonymous records from variant not respecting @as decorator #6549

Closed
cwstra opened this issue Jan 4, 2024 · 2 comments · Fixed by #6551
Closed

Anonymous records from variant not respecting @as decorator #6549

cwstra opened this issue Jan 4, 2024 · 2 comments · Fixed by #6551

Comments

@cwstra
Copy link

cwstra commented Jan 4, 2024

Tried out all these examples in the playground, w/ rc.8:

If we have a variant type with an aliased property:

type union =
  Member({
    @as("annoyinglyLongName") shortName: string
  })

we can successfully generate a binding to this property via a function:

let shortName = (Member({shortName})) => shortName
function shortName(param) {
  return param.annoyinglyLongName;
}

Huzzah!

However, if instead we grab the inner record, and access the property off that, the name mapping fails to kick in.

let shortName' = (Member(r)) => r.shortName
function accessRec$p(r) {
  return r.shortName;
}
@tsnobip
Copy link
Contributor

tsnobip commented Jan 6, 2024

oh that's a good catch.

Repro with v11-rc.8 here

Kind of a duplicate of #6438, unfortunately #6456 seems to only fix for the first case, not your second function.

@tsnobip
Copy link
Contributor

tsnobip commented Jan 18, 2024

fixed by #6551

@tsnobip tsnobip closed this as completed Jan 18, 2024
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

Successfully merging a pull request may close this issue.

2 participants