Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bug]: Division of an object after < #6323

Closed
p51lee opened this issue Nov 2, 2022 · 1 comment · Fixed by #6469
Closed

[Bug]: Division of an object after < #6323

p51lee opened this issue Nov 2, 2022 · 1 comment · Fixed by #6469
Labels
Milestone

Comments

@p51lee
Copy link

p51lee commented Nov 2, 2022

Describe the bug

Dividing an object in a right-hand-side of < or > causes a transpilation fail.
This issue is similar with the previous issue #6322, in that they are both related to division of an object,
but I am submitting these issues separately because I think those two might have separated root cause in that the previous one requires the division to be in for-loop condition and this one requires the division to be at RHS of < or >.

Input code

let x = 0 < { } / 0 ;

Config

No response

Playground link

https://play.swc.rs/?version=1.3.11&code=H4sIAAAAAAAAA8tJLVGoULBVMFCwUahWqFXQB7KsAb6dryUVAAAA&config=H4sIAAAAAAAAA0WMTQrEIAxG75K1286id5hDBCctFv9IUhgR714tlu7C915ehUMsrBUyshCPS0pU%2FMMKZAOKZZcVTNf6tKEXagYUeScdiiyd%2BZSEJjUQXHRbGSWbQmYSeRHG3T9m66GQfucYKmjJdAc%2F0N7G%2FHPynaLySe0Cj9ke9LUAAAA%3D

Expected behavior

input.js is a valid JavaScript code:

$ node input.js

Actual behavior

SWC fails to transpile input.js; it thinks / 0 ; is an unterminated regexp literal:
image

Version

1.3.11 (default SWC playground)

Additional context

No response

@p51lee p51lee added the C-bug label Nov 2, 2022
@kdy1 kdy1 added this to the Planned milestone Nov 2, 2022
kdy1 pushed a commit that referenced this issue Nov 18, 2022
**Related issue:**

 - Closes #6322.
 - Closes #6323.
@kdy1 kdy1 modified the milestones: Planned, v1.3.19 Nov 20, 2022
@swc-bot
Copy link
Collaborator

swc-bot commented Dec 20, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Dec 20, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants