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 guess the following problem is caused by overloading a generic proc on typedesc:
type
OptionKind = enum
None,
Some
Option*[T] = object
case kind: OptionKind
of None:
discard
of Some:
value*: T
proc none*[T](): Option[T] =
Option[T](kind: None)
proc none*(T: typedesc): Option[T] = none[T]()
proc test(): Option[int] =
int.none
echo test()
This results in the following error regarding the C compilation:
/tmp/tmp.9fZIF9AH68/stdlib_system.c: In function ‘HEX24_90091’:
/tmp/tmp.9fZIF9AH68/stdlib_system.c:11193:22: error: expected identifier before ‘)’ token
if (!(((2 &(1<<((x.)&7)))!=0))) raiseFieldError(((NimStringDesc*) &TMP145));
That's interesting. In my actual implementation I do have a $ proc, and (as far as I remember) I did not echo an Option, but I still get the error. So it looks like the error can somehow come back. I do not even have to call the none(typedesc) proc, just having it defined causes a problem. What is also interesting is that the error is not "in function" none but always in a function that is close by. For instance, I have this:
.../nimcache/option.c: In function ‘some_765109’:
.../nimcache/option.c:656:24: error: expected identifier before ‘)’ token
if (!(((2 &(1<<((LOC1.)&7)))!=0))) raiseFieldError(((NimStringDesc*) &TMP687));
Another surprise: If I reverse the order of the some and none functions, it works! Update: No, error came back, depending on use on client side...
I guess the following problem is caused by overloading a generic proc on typedesc:
This results in the following error regarding the C compilation:
Version: devel c82cc7c
The text was updated successfully, but these errors were encountered: