mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
fixes #7528
This commit is contained in:
@@ -1333,7 +1333,10 @@ proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt =
|
||||
if typ.callConv == ccClosure: result = 2 * ptrSize
|
||||
else: result = ptrSize
|
||||
a = ptrSize
|
||||
of tyNil, tyCString, tyString, tySequence, tyPtr, tyRef, tyVar, tyLent, tyOpenArray:
|
||||
of tyString, tyNil:
|
||||
result = ptrSize
|
||||
a = result
|
||||
of tyCString, tySequence, tyPtr, tyRef, tyVar, tyLent, tyOpenArray:
|
||||
let base = typ.lastSon
|
||||
if base == typ or (base.kind == tyTuple and base.size==szIllegalRecursion):
|
||||
result = szIllegalRecursion
|
||||
|
||||
14
tests/metatype/tautotypetrait.nim
Normal file
14
tests/metatype/tautotypetrait.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
output: "(Field0: "string", Field1: "string")"
|
||||
"""
|
||||
|
||||
# 7528
|
||||
import macros
|
||||
import typetraits
|
||||
|
||||
macro bar*(n: untyped): typed =
|
||||
result = newNimNode(nnkStmtList, n)
|
||||
result.add(newCall("write", newIdentNode("stdout"), n))
|
||||
|
||||
proc foo0[T](): auto = return (T.name, T.name)
|
||||
bar foo0[string]()
|
||||
Reference in New Issue
Block a user