You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Comments can alter code generation in a way that produces broken code.
This has been noticed specifically in functions
with comments that occur between the return keyword and the end of the returned statement.
leta=undefined// This comment is perfectly safe.??1letb=(()=>{returnundefined// This comment breaks something in svelte's code generation??1})()console.log(a)// 1console.log(b)// undefined
Expected behavior
All functions should return 1.
Information about your Svelte project:
Your browser and the version: Firefox 81.0b3
Svelte version: REPL 3.24.1
Severity
High. The fact that a comment can silently break code is a major issue for me on the level of ditching the framework entirely.
That said, I would say impact is between moderate and low. I have not checked and identified all cases in which this will be triggered, but so long as it is only triggered in the return statement, I cannot imagine it affecting too many projects.
As it occurs with at least the null coalescing operator and the *ternary operator *, I believe it is ok to assume some projects are potentially imparted by this in the wild. Depending on what other operations and expressions trigger this bug, it could have up to a moderate impact.
So long as this issue is only present in return statements, Impact probably isn't much higher than moderate (depending on what operations and expressions are affected, could be low).
That said, projects that are affected may not notice since the issue (as presently understood) only occurs when the operators should return their secondary/fallback values.
Additional context
Originally was being used in a sort operation with the intent of being used for in a multi-select component.
Rant
The number of silent bugs I have encountered are starting to pile up, so I may be leaving with this. Svelte is a very fun language to type, so I believe it can take over. But the DX, while improving daily, is still horrid imho for projects scripted with moderate complexity.
Its hard to convince myself that I am hitting corner cases with the quantity I have had to work around in the last 3 weeks of play.
And, unfortunately, I am not good enough of a developer to identify and work around compiler bugs in addition to analyzing and debugging the code I wrote this often. Mentally, I am marking svelte, the language, as beta(lots of things either needs more thorough docs or a better compiler, can't say which without reading rfcs, but assuming the latter) and svelte, the compiler, as an (mentally)unstable alpha.
The text was updated successfully, but these errors were encountered:
Describe the bug
Comments can alter code generation in a way that produces broken code.
This has been noticed specifically in functions
with comments that occur between the return keyword and the end of the returned statement.
Logs
No errors reported
To Reproduce
Here is a repl demonstrating the issue with comments between the null coalescing operator.
A simpler example included below for brevity
Expected behavior
All functions should return 1.
Information about your Svelte project:
Your browser and the version: Firefox 81.0b3
Svelte version: REPL 3.24.1
Severity
High. The fact that a comment can silently break code is a major issue for me on the level of ditching the framework entirely.
That said, I would say impact is between moderate and low. I have not checked and identified all cases in which this will be triggered, but so long as it is only triggered in the return statement, I cannot imagine it affecting too many projects.
As it occurs with at least the null coalescing operator and the *ternary operator *, I believe it is ok to assume some projects are potentially imparted by this in the wild. Depending on what other operations and expressions trigger this bug, it could have up to a moderate impact.
So long as this issue is only present in return statements, Impact probably isn't much higher than moderate (depending on what operations and expressions are affected, could be low).
That said, projects that are affected may not notice since the issue (as presently understood) only occurs when the operators should return their secondary/fallback values.
Additional context
Originally was being used in a sort operation with the intent of being used for in a multi-select component.
Rant
The number of silent bugs I have encountered are starting to pile up, so I may be leaving with this. Svelte is a very fun language to type, so I believe it can take over. But the DX, while improving daily, is still horrid imho for projects scripted with moderate complexity.Its hard to convince myself that I am hitting corner cases with the quantity I have had to work around in the last 3 weeks of play.
And, unfortunately, I am not good enough of a developer to identify and work around compiler bugs in addition to analyzing and debugging the code I wrote this often. Mentally, I am marking svelte, the language, as beta(lots of things either needs more thorough docs or a better compiler, can't say which without reading rfcs, but assuming the latter) and svelte, the compiler, as an (mentally)unstable alpha.
The text was updated successfully, but these errors were encountered: