undo RFC #294, it breaks code for no good reason, the compiler can wa… (#18546)

* 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:
Andreas Rumpf 2021-07-21 08:51:03 +02:00 • committed by GitHub
commit 70fb377e88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 15 deletions

View file

@ -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"