You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Packed tuple and equal unpacked tuple give wrong field values #26424
Nim Compiler Version 2.3.1 [MacOSX: arm64]
Compiled at 2026-10-10
Copyright (c) 2006-2026 by Andreas Rumpf
git hash: b081880000a4d708cdce6afcc4c4124a60a5c62e
Description
typePacked {.packed.} =tuple[a: int8, b: int32]
Plain=tuple[a: int8, b: int32]
var p: Packed= (a: 1'i8, b: 2'i32)
var q: Plain= p
echo q
Current Output
(a: 1, b: 0)
Expected Output
(a: 1, b: 2)
Known Workarounds
No response
Additional Information
Same behaviour on 2.2.12. 2.0.10 prints (a: 1, b: 2).
haha :) Yeah wasn't sure. on UnnamedTuple, pragmas don't make sense, on named ones, they seem to be generally buggy (it's not just {.packed.} but the underlying type conflation issue happens on any pragma)
The bycopy pragma can be applied to an object or tuple type or a proc param.
How to know what pragma violates the structure identity?
i.e., generally, it seems like the first instance gets picked. So, getCustomPragma etc also is based on the first definition, the later ones (if any) that happen to alias it get wrong answers if they don't match in pragmas.
Activity
Araq commentedon Oct 10, 2026
.packedon tuples is not a supported feature at all.etan-status commentedon Oct 10, 2026
haha :) Yeah wasn't sure. on UnnamedTuple, pragmas don't make sense, on named ones, they seem to be generally buggy (it's not just {.packed.} but the underlying type conflation issue happens on any pragma)
Araq commentedon Oct 10, 2026
Tuples are always structural types, the structure defines their identity, every pragma that violates this (
importctoo) is invalid for tuples.etan-status commentedon Oct 10, 2026
Mmh, the manual itself mentions pragmas on tuples:
How to know what pragma violates the structure identity?
i.e., generally, it seems like the first instance gets picked. So, getCustomPragma etc also is based on the first definition, the later ones (if any) that happen to alias it get wrong answers if they don't match in pragmas.
Araq commentedon Oct 15, 2026
The manual is wrong too.