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

Deno panicked with wrong assignment statement #25152

Closed
tbontb-iaq opened this issue Aug 22, 2024 · 1 comment
Closed

Deno panicked with wrong assignment statement #25152

tbontb-iaq opened this issue Aug 22, 2024 · 1 comment
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling)

Comments

@tbontb-iaq
Copy link

Version: Deno 1.46.0

Run with RUST_BACKTRACE=full deno:

Deno 1.46.0
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> let a, b
undefined
> (true ? a : b) = 1

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.46.0
Args: ["deno"]

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_base-0.143.3/src/fixer.rs:197:64:
called `Result::unwrap()` on an `Err` value: Cond(CondExpr { span: 2..14, test: Lit(Bool(Bool { span: 2..6, value: true })), cons: Ident(Ident { span: 9..10, ctxt: #1, sym: "a", optional: false }), alt: Ident(Ident { span: 13..14, ctxt: #1, sym: "b", optional: false }) })
stack backtrace:
   0:     0x633747b10635 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd736fd5964392270
   1:     0x633747b42feb - core::fmt::write::hc6043626647b98ea
   2:     0x633747b0a69f - std::io::Write::write_fmt::h0d24b3e0473045db
   3:     0x633747b1040e - std::sys_common::backtrace::print::h45eb8174d25a1e76
   4:     0x633747b11e79 - std::panicking::default_hook::{{closure}}::haf3f0170eb4f3b53
   5:     0x633747b11c1a - std::panicking::default_hook::hb5d3b27aa9f6dcda
   6:     0x633748102790 - deno::setup_panic_hook::{{closure}}::ha5d650d81034dc22
   7:     0x633747b124eb - std::panicking::rust_panic_with_hook::h6b49d59f86ee588c
   8:     0x633747b12264 - std::panicking::begin_panic_handler::{{closure}}::hd4c2f7ed79b82b70
   9:     0x633747b10af9 - std::sys_common::backtrace::__rust_end_short_backtrace::h2946d6d32d7ea1ad
  10:     0x633747b11f97 - rust_begin_unwind
  11:     0x633747b3ff33 - core::panicking::panic_fmt::ha02418e5cd774672
  12:     0x633747b40426 - core::result::unwrap_failed::h55f86ada3ace5ed2
  13:     0x633749a2375e - <swc_ecma_transforms_base::fixer::Fixer as swc_ecma_visit::generated::VisitMut>::visit_mut_expr::hcc77f68e81af403d
  14:     0x633749a19662 - <swc_ecma_ast::stmt::Stmt as swc_ecma_visit::generated::VisitMutWith<V>>::visit_mut_children_with::hdc34bd0734067587
  15:     0x633749a23c1d - <swc_ecma_transforms_base::fixer::Fixer as swc_ecma_visit::generated::VisitMut>::visit_mut_stmt::h01b24bef9ddb206d
  16:     0x633749a0edbc - swc_ecma_visit::generated::VisitMut::visit_mut_module_items::h1cf23faa73762a95
  17:     0x633749a23a70 - <swc_ecma_transforms_base::fixer::Fixer as swc_ecma_visit::generated::VisitMut>::visit_mut_module::h0cc424093d6247b5
  18:     0x63374992e550 - <swc_ecma_ast::module::Program as swc_ecma_visit::generated::FoldWith<V>>::fold_with::h29884bbc2394843e
  19:     0x63374994ea85 - deno_ast::transpiling::fold_program::hf8d3bd252687d7c9
  20:     0x63374994d4d6 - deno_ast::transpiling::transpile::h89acf1a6c34a6739
  21:     0x63374994cd42 - deno_ast::transpiling::<impl deno_ast::parsed_source::ParsedSource>::transpile::h4b73a76e4129ff82
  22:     0x633748088d4e - deno::tools::repl::session::ReplSession::evaluate_ts_expression::{{closure}}::h12c4507da174464a
  23:     0x633748086e4c - deno::tools::repl::session::ReplSession::evaluate_line_with_object_wrapping::{{closure}}::hc27a773cc8ec8552
  24:     0x6337480853e8 - deno::tools::repl::session::ReplSession::evaluate_line_and_get_output::{{closure}}::h68ba3c8d1690f6ac
  25:     0x63374808a48c - deno::tools::repl::run::{{closure}}::hf5317114789cb470
  26:     0x6337480e1cf2 - deno::spawn_subcommand::{{closure}}::h1f0b708a84de9fe7
  27:     0x633747b5b531 - <deno_unsync::tokio::task::MaskFutureAsSend<F> as core::future::future::Future>::poll::h92b84cc1b42449d4
  28:     0x633747d40734 - tokio::runtime::task::raw::poll::had8bbf83cff3cbce
  29:     0x6337481042b9 - deno::main::hfc1529a609826c3c
  30:     0x633747c0cccf - std::sys_common::backtrace::__rust_begin_short_backtrace::ha691cd64654fb0f4
  31:     0x633747c14cfa - std::rt::lang_start::{{closure}}::hbebf3fbed7d80092
  32:     0x633747afe69d - std::rt::lang_start_internal::hcee5ed89fc25829a
  33:     0x63374819a425 - main
  34:     0x7740d8c29d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  35:     0x7740d8c29e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  36:     0x633746471029 - _start
  37:                0x0 - <unknown>

Same code in node:

Welcome to Node.js v20.16.0.
Type ".help" for more information.
> let a, b
undefined
> (true ? a : b) = 1
(true ? a : b) = 1
^^^^^^^^^^^^^^

Uncaught SyntaxError: Invalid left-hand side in assignment
@lucacasonato lucacasonato added bug Something isn't working correctly swc related to swc (bundling/transpiling) labels Aug 22, 2024
@littledivy
Copy link
Member

Seems fixed. Better error with Deno 2.

[divy@divy deno]$ deno
Deno 2.0.0
exit using ctrl+d, ctrl+c, or close()
REPL is running with all permissions allowed.
To specify permissions, run `deno repl` with allow flags.
> let a, b
undefined
> (true ? a : b) = 1
error: The left-hand side of an assignment expression must be a variable or a property access. at file:///repl.tsx:1:1

  (true ? a : b) = 1
  ~~~~~~~~~~~~~~

The left-hand side of an assignment expression must be a variable or a property access. at file:///repl.tsx:1:1

  (true ? a : b) = 1
  ~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

3 participants