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

Bug when accessing nested list #179

Closed
sebffischer opened this issue Sep 27, 2024 · 3 comments · Fixed by #180
Closed

Bug when accessing nested list #179

sebffischer opened this issue Sep 27, 2024 · 3 comments · Fixed by #180
Labels
type-bug Something isn't working

Comments

@sebffischer
Copy link
Collaborator

sebffischer commented Sep 27, 2024

Update: The issues that were listed here were actually different bugs.
The bug below still persists.

> l = list(a = list(b = 1))
$a
$a$b
[1] 1

> l$a$b[1]
NULL
> 

But it works like this:

(l$a$b)[1]

I therefore believe this is due to the parser (?)

When fixing this, tests should also cover that:

  • l <- (1, ); environment()$l[[1]] and
  • l <- (1, ); environment()$l[[1]] = 2 work
@sebffischer
Copy link
Collaborator Author

This is not a problem when relying on the [[ operator:

> l[["a"]][["b"]][1]
[1] 1

@sebffischer
Copy link
Collaborator Author

I will try to also fix this in #172

@sebffischer
Copy link
Collaborator Author

Related to the [[-assignnment, there is also this bug:

> l = list(environment())
[[1]]
<environment 0x6000002980d8>

> l[[1]] = 100
Error: Invalid target for assignment
backtrace:
1: l[[1]] <- 100 => None
> 

in this case, $-assignment works fine:

> l = list(a = environment())
$a
<environment 0x6000002980d8>

> l$a = 1
$a
[1] 1

> l

@sebffischer sebffischer mentioned this issue Oct 2, 2024
8 tasks
@sebffischer sebffischer added the type-bug Something isn't working label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant