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'm trying to get some fixed multi-precision integer working.
While trying to create aliases, it seems like macro do not like static arguments in a type declaration context. It works fine however in a variable declaration context:
import macros, typetraits
macrogetBase*(bits: static[int]): untyped=if bits ==128:
result=newTree(nnkBracketExpr, ident("MpUintBase"), ident("uint64"))
else:
result=newTree(nnkBracketExpr, ident("MpUintBase"), ident("uint32"))
typeBaseUint*=SomeUnsignedIntorMpUintBaseMpUintBase*[BaseUint] =object
lo*, hi*: BaseUint## This gets type mismatchMpUint*[bits: static[int]] =getBase(bits)
## This works finevar foo: getBase(64)
echo foo.type.name
The text was updated successfully, but these errors were encountered:
mratsim
changed the title
Static: compiler internal error: getTypeDescAux(tyNone)
Macro + static: type mismatch in type declaration but not in var declaration
Feb 17, 2018
I'm trying to get some fixed multi-precision integer working.
While trying to create aliases, it seems like macro do not like static arguments in a type declaration context. It works fine however in a variable declaration context:
The text was updated successfully, but these errors were encountered: