mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-28 11:26:39 +00:00
closed ambiguous enum defaults to first overload (#20457)
* closed ambiguous enum defaults to first overload * add warning * turn to hint * work around config
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
discard """
|
||||
errormsg: "ambiguous identifier"
|
||||
errormsg: "ambiguous enum field"
|
||||
file: "tambsym3.nim"
|
||||
line: 11
|
||||
line: 14
|
||||
"""
|
||||
# Test ambiguous symbols
|
||||
|
||||
import mambsym1, times
|
||||
|
||||
{.hint[AmbiguousEnum]: on.}
|
||||
{.hintAsError[AmbiguousEnum]: on.}
|
||||
|
||||
var
|
||||
v = mDec #ERROR_MSG ambiguous identifier
|
||||
|
||||
|
||||
@@ -8,3 +8,8 @@ template t =
|
||||
doAssert some(Success)
|
||||
|
||||
t()
|
||||
|
||||
block: # legacy support for behavior before overloadableEnums
|
||||
# warning: ambiguous enum field 'Success' assumed to be of type MyEnum
|
||||
let x = {Success}
|
||||
doAssert x is set[MyEnum]
|
||||
|
||||
Reference in New Issue
Block a user