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

Inconsistent $ref codegen #4442

Closed
jods4 opened this issue Aug 25, 2021 · 0 comments · Fixed by #4446
Closed

Inconsistent $ref codegen #4442

jods4 opened this issue Aug 25, 2021 · 0 comments · Fixed by #4446
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler

Comments

@jods4
Copy link
Contributor

jods4 commented Aug 25, 2021

Version

3.2.6

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcblxubGV0IG1zZyA9ICRyZWY8c3RyaW5nIHwgbnVtYmVyPignSGVsbG8gV29ybGQhJyk7XG5tc2cgPSA0Mjtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxoMT57eyBtc2cgfX08L2gxPlxuICA8aW5wdXQgdi1tb2RlbD1cIm1zZ1wiPlxuPC90ZW1wbGF0ZT4ifQ==

Steps to reproduce

This repro tries to use a generically typed $ref<string | number>:
https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcblxubGV0IG1zZyA9ICRyZWY8c3RyaW5nIHwgbnVtYmVyPignSGVsbG8gV29ybGQhJyk7XG5tc2cgPSA0Mjtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxoMT57eyBtc2cgfX08L2gxPlxuICA8aW5wdXQgdi1tb2RlbD1cIm1zZ1wiPlxuPC90ZW1wbGF0ZT4ifQ==

It doesn't work and if you look at the JS code, $ref was passed through without modification.

Strangely, if I add a second simple $ref, such as in this example:
https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcblxubGV0IHggPSAkcmVmKDEpO1xubGV0IG1zZyA9ICRyZWY8c3RyaW5nIHwgbnVtYmVyPignSGVsbG8gV29ybGQhJyk7XG5tc2cgPSA0Mjtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxoMT57eyBtc2cgfX08L2gxPlxuICA8aW5wdXQgdi1tb2RlbD1cIm1zZ1wiPlxuPC90ZW1wbGF0ZT4ifQ==

Now they're both correctly transformed??

What is expected?

First repro should work as well

What is actually happening?

$ref<string> isn't transformed when there's no other $ref.

@edison1105 edison1105 added scope: compiler 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Aug 26, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants