Open ploiu opened 5 months ago
Thanks for the detailed bug report. The message is indeed confusing. Might be related to the outer REPL code. SWC alone throws this error:
x Not a pattern
,-[input.tsx:1:1]
1 | (0) => 1
: ^
`----
Caused by:
0: failed to process js file
1: Syntax Error
Hi @lucacasonato @marvinhagemeister , I need to work on it but would need some guidance on where to begin debugging it.
@marvinhagemeister Is that the right respond?
@lucacasonato, @marvinhagemeister, @dsherret, @bartlomieju
I tried to debug the REPL scenario.
I found the source ="(0) => 1"
, it was parsed as "(<invalid>)=>1;"
I found that the "parse_string_input" method in deno_ast parse a program; the erroneous result stems from this parsing.
I tried to debug the pars module in SWC to determine why it returned "<invalid>"
, but I'm still unsure of how it does so. If you have any knowledge about this area or know one can assist me in this area, please let me know.
Additionally, when I tried to debug the run script scenario, I was unable to locate the plea to parse the script, which it's different from location of REPL.
deno --version
: deno 1.43.5 (release, x86_64-pc-windows-msvc) v8 12.4.254.13 typescript 5.4.5I did not find this issue after searching in the issues tab for this repository.
about: deno gives a confusing error message when incorrectly declaring an arrow function. example from REPL:
This can be extremely confusing in normal development because there is no
<
in the source code for the user to refer to.deno run
as well as the REPLnull
as the parameterInfinity
,[]
,{}
,undefined
, etc. all successfully create an anonymous function)(1, undefined) => 0
replicates this)parse error: Expected ';', '}' or <eof>
)This appears to happen regardless of context. Attempting this with a non-arrow function results in a much more helpful error message. Browsers and
tsc
each give a different error message, and none of them mention<
anywhere (browsers tried were chromium-edge and firefox).Please let me know if this is the wrong bug report format or if this is the wrong place to submit this report, as this is my first issue report in a long time :)