mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-19 01:18:32 +00:00
fixes #59
This commit is contained in:
@@ -663,6 +663,9 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
elif efAllowType notin flags:
|
||||
GlobalError(n.sons[0].info, errATypeHasNoValue)
|
||||
return
|
||||
# reset to prevent 'nil' bug: see "tests/reject/tenumitems.nim":
|
||||
ty = n.sons[0].Typ
|
||||
|
||||
ty = skipTypes(ty, {tyGenericInst, tyVar, tyPtr, tyRef})
|
||||
var check: PNode = nil
|
||||
if ty.kind == tyObject:
|
||||
|
||||
9
tests/reject/tenumitems.nim
Normal file
9
tests/reject/tenumitems.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
discard """
|
||||
line: 7
|
||||
errormsg: "a type has no value"
|
||||
"""
|
||||
|
||||
type a = enum b,c,d
|
||||
a.items()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user