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 couldn't really think of a better title (why do I always run into the weirdest bugs), so here's an example:
Example
type
A =object
B =objectprocf(a: A) =discardprocg[T](value: T, cb: (proc(a: T)) = f) =cb value
# This should fail because there is no f(a: B) overload availablegB()
Current Output
/usercode/nimcache/@min.nim.c: In function 'NimMainModule':
/usercode/nimcache/@min.nim.c:138:34: error: expected expression before ')' token
g__blFRD9cre3iSc5obJINpxvg(T1_, );
^
Error: execution of an external program failed: 'gcc -c -w -I/playground/nim/lib -I/usercode -o /usercode/nimcache/@min.nim.c.o /usercode/nimcache/@min.nim.c'
Expected Output
A compiler error because g(a: B) does not exist.
Possible Solution
I'm honestly not sure why this occurs, but it's definitely related to the default value of cb. If I remove the default and pass f as a second argument to g at the call site, an error is properly displayed.
$ nim -v
Nim Compiler Version 1.0.6
The text was updated successfully, but these errors were encountered:
I couldn't really think of a better title (why do I always run into the weirdest bugs), so here's an example:
Example
Current Output
Expected Output
A compiler error because
g(a: B)
does not exist.Possible Solution
I'm honestly not sure why this occurs, but it's definitely related to the default value of
cb
. If I remove the default and passf
as a second argument tog
at the call site, an error is properly displayed.The text was updated successfully, but these errors were encountered: