* undo RFC #294, it breaks code for no good reason, the compiler can warn about the construct instead * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * enable test case Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
parent
f8519657c4
commit
70fb377e88
5 changed files with 10 additions and 15 deletions
|
|
@ -70,6 +70,7 @@ type
|
|||
warnResultUsed = "ResultUsed",
|
||||
warnCannotOpen = "CannotOpen",
|
||||
warnFileChanged = "FileChanged",
|
||||
warnSuspiciousEnumConv = "EnumConv",
|
||||
warnUser = "User",
|
||||
# hints
|
||||
hintSuccess = "Success", hintSuccessX = "SuccessX",
|
||||
|
|
@ -153,6 +154,7 @@ const
|
|||
warnResultUsed: "used 'result' variable",
|
||||
warnCannotOpen: "cannot open: $1",
|
||||
warnFileChanged: "file changed: $1",
|
||||
warnSuspiciousEnumConv: "$1",
|
||||
warnUser: "$1",
|
||||
hintSuccess: "operation successful: $#",
|
||||
# keep in sync with `testament.isSuccess`
|
||||
|
|
|
|||
|
|
@ -168,9 +168,7 @@ proc checkConvertible(c: PContext, targetTyp: PType, src: PNode): TConvStatus =
|
|||
elif (targetBaseTyp.kind in IntegralTypes) and
|
||||
(srcBaseTyp.kind in IntegralTypes):
|
||||
if targetTyp.kind == tyEnum and srcBaseTyp.kind == tyEnum:
|
||||
if c.config.isDefined("nimLegacyConvEnumEnum"):
|
||||
message(c.config, src.info, warnUser, "enum to enum conversion is now deprecated")
|
||||
else: result = convNotLegal
|
||||
message(c.config, src.info, warnSuspiciousEnumConv, "suspicious code: enum to enum conversion")
|
||||
# `elif` would be incorrect here
|
||||
if targetTyp.kind == tyBool:
|
||||
discard "convOk"
|
||||
|
|
|
|||
|
|
@ -1598,8 +1598,6 @@ proc typeMismatch*(conf: ConfigRef; info: TLineInfo, formal, actual: PType, n: P
|
|||
of efLockLevelsDiffer:
|
||||
msg.add "\nlock levels differ"
|
||||
|
||||
if formal.kind == tyEnum and actual.kind == tyEnum:
|
||||
msg.add "\nmaybe use `-d:nimLegacyConvEnumEnum` for a transition period"
|
||||
localError(conf, info, msg)
|
||||
|
||||
proc isTupleRecursive(t: PType, cycleDetector: var IntSet): bool =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue