-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
What happened?
The following code:
type
Either[A,B] = object
case kind:bool
of false:
b: B
of true:
a: A
O = object of RootRef
proc oToEither(o:O):Either[O,void] =
Either[O,void](kind:true,a: o)
discard oToEither(O())fails to compile with:
/home/deech/.cache/nim/test_d/@mtest.nim.c:73:107: error: ‘union <anonymous>’ has no member named ‘_kind_1’; did you mean ‘_kind_2’?
73 | static NIM_CONST tyObject_Either__D9a6Bf9aw0xiqmc0h0TIPoaw TM__ipcYmBC9bj9a1BW35ABoB1Kw_2 = {NIM_FALSE, {._kind_1 = {}}}
| ^~~~~~~
| _kind_2
Seems the default value of the Either tries to use a struct parameter that doesn't exist.
Nim Version
Nim Compiler Version 1.7.3 [Linux: amd64]
Compiled at 2022-10-29
Copyright (c) 2006-2022 by Andreas Rumpf
git hash: 534c97edc54ffb6d55baa5084f8c426a451c9244
active boot switches: -d:release
Current Standard Output Logs
No response
Expected Standard Output Logs
No response
Possible Solution
No response
Additional Information
No response