Tests for v1 closed generics/static issues (#8572)
* Add tests to confirm https://github.com/nim-lang/Nim/issues/7231 is fixed. * Add test for closed https://github.com/nim-lang/Nim/issues/6137 * Add test for https://github.com/nim-lang/Nim/issues/7141
This commit is contained in:
parent
506418ef53
commit
bccaa36aba
3 changed files with 51 additions and 0 deletions
|
|
@ -99,3 +99,15 @@ echo sizeof(a)
|
|||
echo sizeof(b)
|
||||
echo sizeof(c)
|
||||
|
||||
# This is the same example but using a proc instead of a macro
|
||||
# Instead of type mismatch for macro, proc just failed with internal error: getTypeDescAux(tyNone)
|
||||
# https://github.com/nim-lang/Nim/issues/7231
|
||||
|
||||
proc getBase2*(bits: static[int]): typedesc =
|
||||
if bits == 128:
|
||||
result = newTree(nnkBracketExpr, ident("MpUintBase"), ident("uint64"))
|
||||
else:
|
||||
result = newTree(nnkBracketExpr, ident("MpUintBase"), ident("uint32"))
|
||||
|
||||
type
|
||||
MpUint2*[bits: static[int]] = getbase2(bits)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue