mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-22 08:51:21 +00:00
fixes a regression caused by overloadable enums even though they're opt-in (#18970)
This commit is contained in:
@@ -250,7 +250,7 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
|
||||
of skUnknown:
|
||||
# Introduced in this pass! Leave it as an identifier.
|
||||
result = n
|
||||
of OverloadableSyms:
|
||||
of OverloadableSyms-{skEnumField}:
|
||||
result = symChoice(c, n, s, scOpen, isField)
|
||||
of skGenericParam:
|
||||
if isField and sfGenSym in s.flags: result = n
|
||||
@@ -261,8 +261,12 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
|
||||
if isField and sfGenSym in s.flags: result = n
|
||||
else: result = newSymNodeTypeDesc(s, c.idgen, n.info)
|
||||
else:
|
||||
if isField and sfGenSym in s.flags: result = n
|
||||
else: result = newSymNode(s, n.info)
|
||||
if s.kind == skEnumField and overloadableEnums in c.features:
|
||||
result = symChoice(c, n, s, scOpen, isField)
|
||||
elif isField and sfGenSym in s.flags:
|
||||
result = n
|
||||
else:
|
||||
result = newSymNode(s, n.info)
|
||||
# Issue #12832
|
||||
when defined(nimsuggest):
|
||||
suggestSym(c.graph, n.info, s, c.graph.usageSym, false)
|
||||
|
||||
4
tests/enum/mregression.nim
Normal file
4
tests/enum/mregression.nim
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
type
|
||||
OtherEnum* = enum
|
||||
Success, Failed, More
|
||||
13
tests/enum/tregression.nim
Normal file
13
tests/enum/tregression.nim
Normal file
@@ -0,0 +1,13 @@
|
||||
discard """
|
||||
action: "compile"
|
||||
"""
|
||||
import options, mregression
|
||||
|
||||
type
|
||||
MyEnum = enum
|
||||
Success
|
||||
|
||||
template t =
|
||||
echo some(Success)
|
||||
|
||||
t()
|
||||
Reference in New Issue
Block a user