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

Crash in expression = [...myvar] #2237

Open
Melkor333 opened this issue Jan 24, 2025 · 2 comments
Open

Crash in expression = [...myvar] #2237

Melkor333 opened this issue Jan 24, 2025 · 2 comments

Comments

@Melkor333
Copy link
Collaborator

The following crashes (on my mobile phone, couldn't test on desktop) with the tarball including the GLOB_PERIOD fix:

ysh-0.26.0$ var y = [1,2]
ysh-0.26.0$ = [...y]
_gen/bin/oils_for_unix.mycpp.cc:54671: syntax_asdl::expr_t *expr_to_ast::Transformer::Expr(pnode::PNode *): assertion "0" failed
Aborted

I'd like to be able to copy an arrays which sadly doesn't work simply that way :(

@andychu
Copy link
Contributor

andychu commented Jan 24, 2025

Oh yeah this is a bug, thanks for the report

For now you can use var x = list(y) ++ [4,5,6]

@andychu andychu changed the title [...var] crashes Crash in expression = [...myvar] Jan 24, 2025
andychu pushed a commit that referenced this issue Feb 2, 2025
@andychu
Copy link
Contributor

andychu commented Feb 2, 2025

I would like for YSH to support this, but for now I added a proper syntax error

Will be out with the next release

===== CASE: -n -c = [42, ...y] =====


  = [42, ...y]
         ^~~
[ -c flag ]:1: Splat not currently supported

===== CASE: -n -c = (...x for x in [1,2,3]) =====


  = (...x for x in [1,2,3])
     ^~~
[ -c flag ]:1: Splat not currently supported

===== CASE: -n -c = [...x for x in [1,2,3]] =====


  = [...x for x in [1,2,3]]
     ^~~
[ -c flag ]:1: Splat not currently supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants