This commit is contained in:
Araq 2011-11-02 02:36:01 +01:00
commit 77222b2aad
2 changed files with 12 additions and 0 deletions

View file

@ -663,6 +663,9 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
elif efAllowType notin flags: elif efAllowType notin flags:
GlobalError(n.sons[0].info, errATypeHasNoValue) GlobalError(n.sons[0].info, errATypeHasNoValue)
return return
# reset to prevent 'nil' bug: see "tests/reject/tenumitems.nim":
ty = n.sons[0].Typ
ty = skipTypes(ty, {tyGenericInst, tyVar, tyPtr, tyRef}) ty = skipTypes(ty, {tyGenericInst, tyVar, tyPtr, tyRef})
var check: PNode = nil var check: PNode = nil
if ty.kind == tyObject: if ty.kind == tyObject:

View file

@ -0,0 +1,9 @@
discard """
line: 7
errormsg: "a type has no value"
"""
type a = enum b,c,d
a.items()