macros.error
, macros.warning
, macros.hint
easily conflict with routines with the same name
#24249
Labels
macros.error
, macros.warning
, macros.hint
easily conflict with routines with the same name
#24249
Originally encountered with an error here.
The routines named
error
,warning
andhint
inmacros
all take a single string argument and an optional NimNode argument for the line info, and returnvoid
. This means that calls likeerror("abc")
will match the overload inmacros
.But this is a feasible signature for procs in user code, especially logging libraries (like chronicles, which happens to work around it by requiring the
string
also bestatic
). Ifmacros
is imported, calling these procs can easily give overload ambiguity errors. But themacros
overloads are more specialized, they are only for compile time errors in macros.To fix this, we can rename the overloads in
macros
to something likemacroError
,compileTimeError
etc. (not sure which name is best, would appreciate suggestions), then deprecate the old symbols/remove them with a define. Alternatively we can also require theNimNode
argument for the line info be provided explicitly, but this could still conflict with procs that accept values of any type and stringify them.The text was updated successfully, but these errors were encountered: