fixes #3948
This commit is contained in:
parent
4f1725ad61
commit
a17d45c2c2
2 changed files with 15 additions and 1 deletions
|
|
@ -1160,9 +1160,13 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||||
of tySequence, tyOpt:
|
of tySequence, tyOpt:
|
||||||
if t.sons[0].kind != tyEmpty:
|
if t.sons[0].kind != tyEmpty:
|
||||||
result = typeAllowedAux(marker, t.sons[0], skVar, flags+{taHeap})
|
result = typeAllowedAux(marker, t.sons[0], skVar, flags+{taHeap})
|
||||||
|
elif kind in {skVar, skLet}:
|
||||||
|
result = t.sons[0]
|
||||||
of tyArray:
|
of tyArray:
|
||||||
if t.sons[1].kind != tyEmpty:
|
if t.sons[1].kind != tyEmpty:
|
||||||
result = typeAllowedAux(marker, t.sons[1], skVar, flags)
|
result = typeAllowedAux(marker, t.sons[1], skVar, flags)
|
||||||
|
elif kind in {skVar, skLet}:
|
||||||
|
result = t.sons[1]
|
||||||
of tyRef:
|
of tyRef:
|
||||||
if kind == skConst: result = t
|
if kind == skConst: result = t
|
||||||
else: result = typeAllowedAux(marker, t.lastSon, skVar, flags+{taHeap})
|
else: result = typeAllowedAux(marker, t.lastSon, skVar, flags+{taHeap})
|
||||||
|
|
@ -1181,7 +1185,9 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||||
if result != nil: break
|
if result != nil: break
|
||||||
if result.isNil and t.n != nil:
|
if result.isNil and t.n != nil:
|
||||||
result = typeAllowedNode(marker, t.n, kind, flags)
|
result = typeAllowedNode(marker, t.n, kind, flags)
|
||||||
of tyProxy, tyEmpty:
|
of tyEmpty:
|
||||||
|
if kind in {skVar, skLet}: result = t
|
||||||
|
of tyProxy:
|
||||||
# for now same as error node; we say it's a valid type as it should
|
# for now same as error node; we say it's a valid type as it should
|
||||||
# prevent cascading errors:
|
# prevent cascading errors:
|
||||||
result = nil
|
result = nil
|
||||||
|
|
|
||||||
8
tests/errmsgs/tnested_empty_seq.nim
Normal file
8
tests/errmsgs/tnested_empty_seq.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
discard """
|
||||||
|
errormsg: "invalid type: 'empty' in this context: 'array[0..0, tuple of (string, seq[empty])]' for var"
|
||||||
|
line: 8
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #3948
|
||||||
|
|
||||||
|
var headers=[("headers", @[])]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue