fix #996
This commit is contained in:
parent
37b199d34a
commit
27c2c1e75c
2 changed files with 9 additions and 3 deletions
|
|
@ -398,7 +398,7 @@ const
|
||||||
tyUserTypeClass, tyUserTypeClassInst,
|
tyUserTypeClass, tyUserTypeClassInst,
|
||||||
tyAnd, tyOr, tyNot, tyAnything}
|
tyAnd, tyOr, tyNot, tyAnything}
|
||||||
|
|
||||||
tyMetaTypes* = {tyGenericParam, tyTypeDesc, tyStatic, tyExpr} + tyTypeClasses
|
tyMetaTypes* = {tyGenericParam, tyTypeDesc, tyExpr} + tyTypeClasses
|
||||||
|
|
||||||
type
|
type
|
||||||
TTypeKinds* = set[TTypeKind]
|
TTypeKinds* = set[TTypeKind]
|
||||||
|
|
@ -969,7 +969,9 @@ var emptyNode* = newNode(nkEmpty)
|
||||||
# There is a single empty node that is shared! Do not overwrite it!
|
# There is a single empty node that is shared! Do not overwrite it!
|
||||||
|
|
||||||
proc isMetaType*(t: PType): bool =
|
proc isMetaType*(t: PType): bool =
|
||||||
return t.kind in tyMetaTypes or tfHasMeta in t.flags
|
return t.kind in tyMetaTypes or
|
||||||
|
(t.kind == tyStatic and t.n == nil) or
|
||||||
|
tfHasMeta in t.flags
|
||||||
|
|
||||||
proc linkTo*(t: PType, s: PSym): PType {.discardable.} =
|
proc linkTo*(t: PType, s: PSym): PType {.discardable.} =
|
||||||
t.sym = s
|
t.sym = s
|
||||||
|
|
@ -1313,7 +1315,7 @@ proc propagateToOwner*(owner, elem: PType) =
|
||||||
if tfShared in elem.flags:
|
if tfShared in elem.flags:
|
||||||
owner.flags.incl tfHasShared
|
owner.flags.incl tfHasShared
|
||||||
|
|
||||||
if elem.kind in tyMetaTypes:
|
if elem.isMetaType:
|
||||||
owner.flags.incl tfHasMeta
|
owner.flags.incl tfHasMeta
|
||||||
|
|
||||||
if elem.kind in {tyString, tyRef, tySequence} or
|
if elem.kind in {tyString, tyRef, tySequence} or
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,9 @@ type
|
||||||
TA2[T; I: static[int]] = array[0..I, T]
|
TA2[T; I: static[int]] = array[0..I, T]
|
||||||
TA3[T; I: static[int]] = array[I-1, T]
|
TA3[T; I: static[int]] = array[I-1, T]
|
||||||
|
|
||||||
|
TObj = object
|
||||||
|
x: TA3[int, 3]
|
||||||
|
|
||||||
proc takeFoo(x: TFoo) =
|
proc takeFoo(x: TFoo) =
|
||||||
echo "abracadabra"
|
echo "abracadabra"
|
||||||
echo TFoo.Val
|
echo TFoo.Val
|
||||||
|
|
@ -28,6 +31,7 @@ var
|
||||||
t1: TA1[float, 1]
|
t1: TA1[float, 1]
|
||||||
t2: TA2[string, 4]
|
t2: TA2[string, 4]
|
||||||
t3: TA3[int, 10]
|
t3: TA3[int, 10]
|
||||||
|
t4: TObj
|
||||||
|
|
||||||
# example from the manual:
|
# example from the manual:
|
||||||
type
|
type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue