Listing with computed index has wrong length #243

Closed
opened 2025-12-30 01:22:37 +01:00 by adam · 1 comment
Owner

Originally created by @odenix on GitHub (Nov 5, 2024).

The following program prints length = 2:

local l1 = new Listing {
  "foo"
}

local l2 = (l1) {
  [0 + 0] = "bar"
}

length = l2.length

If [0 + 0] is replaced with [0], the program prints the expected length = 1.

Originally created by @odenix on GitHub (Nov 5, 2024). The following program prints `length = 2`: ``` local l1 = new Listing { "foo" } local l2 = (l1) { [0 + 0] = "bar" } length = l2.length ``` If `[0 + 0]` is replaced with `[0]`, the program prints the expected `length = 1`.
adam added the bug label 2025-12-30 01:22:37 +01:00
adam closed this issue 2025-12-30 01:22:37 +01:00
Author
Owner

@bioball commented on GitHub (Nov 5, 2024):

Good catch!

@bioball commented on GitHub (Nov 5, 2024): Good catch!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#243