8000 Fix #3953: Patch the types of ParamDefs to match their method signature. by sjrd · Pull Request #4533 · scala-js/scala-js · GitHub
[go: up one dir, main page]

Skip to content

Fix #3953: Patch the types of ParamDefs to match their method signature. #4533

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

Merged
merged 2 commits into from
Jul 16, 2021

Conversation

sjrd
Copy link
Member
@sjrd sjrd commented Jul 15, 2021

In some rare cases that involve Higher Kinded Types and type aliases, scalac produces DefDef's whose params' types do not match the method type. This is filed upstream as scala/bug#11884

We work around the issue by patching a posteriori the types of js.ParamDefs and their js.VarRefs to match the type advertised by the method type.

In the entire test suite, the only method that requires a patch is the PartialFunction's applyOrElse in the newly added test case.

All the cases that produce no `js.MethodDef` at all are now handled
directly in `genMethod`. This allows
`genMethodWithCurrentLocalNameScope` to return a `js.MethodDef`
instead of an `Option[js.MethodDef]`.

In addition, we compute `jsParams` only once, with the same code
for all cases.
@sjrd sjrd requested a review from gzm0 July 15, 2021 14:51
… signature.

In some rare cases that involve Higher Kinded Types and type
aliases, scalac produces DefDef's whose params' types do not match
the method type. This is filed upstream as
scala/bug#11884

We work around the issue by patching a posteriori the types of
`js.ParamDef`s and their `js.VarRef`s to match the type advertised
by the method type.

In the entire test suite, the only method that requires a patch is
the `PartialFunction`'s `applyOrElse` in the newly added test case.
@sjrd sjrd force-pushed the fix-param-types branch from 2607fef to 9ff67d5 Compare July 16, 2021 08:26
@sjrd sjrd merged commit 1874820 into scala-js:master Jul 16, 2021
@sjrd sjrd deleted the fix-param-types branch July 16, 2021 11:56
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 this pull request may close these issues.

2 participants
0