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
I made a toy Point[] type, after seeing issue #7569, which is parameterized by a static[int] representing dimension.
The output from echoing instances of that type differs when the instance is const and non-const.
Example
typePoint[T; dim:static[int]] =objectwhen dim >=1: x:T
when dim >=2: y:T
when dim >=3: z:T
procmain=let a =Point[int,2](x:1, y:2)
echo a
const b =Point[int,2](x:1, y:2)
echo b
whenisMainModule:
main()
Current Output
(x: 1, y: 2)
(x: 2, y: 0)
Expected Output
(x: 1, y: 2)
(x: 1, y: 2)
Additional Information
Output of nim -v is
Nim Compiler Version 0.19.9 [Linux: amd64]
Compiled at 2019-05-10
Copyright (c) 2006-2019 by Andreas Rumpf
active boot switches: -d:release
My Nim executable was built ~30 minutes before posting this issue, using choosenim update on the devel channel.
The text was updated successfully, but these errors were encountered:
This is not static related, just the VM being buggy with initialization, especially conditionals, like #7569, #8015, #9622
typePoint[T] =objectwhensizeof(T) >=2: x:T
whensizeof(T) >=4: y:T
whensizeof(T) >=8: z:T
procmain=let a =Point[int32](x:1, y:2)
echo a
const b =Point[int32](x:1, y:2)
echo b
whenisMainModule:
main()
mratsim
changed the title
Initialization of types with static parameter differs in const and non-const contexts
Initialization of types with conditional fields (nkRecWhen) differs in const and non-const contexts
May 10, 2019
I made a toy Point[] type, after seeing issue #7569, which is parameterized by a static[int] representing dimension.
The output from echoing instances of that type differs when the instance is const and non-const.
Example
Current Output
Expected Output
Additional Information
Output of
nim -v
isMy Nim executable was built ~30 minutes before posting this issue, using choosenim update on the devel channel.
The text was updated successfully, but these errors were encountered: