summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2022-03-18 16:41:45 +0100
committerGitHub <noreply@github.com>2022-03-18 16:41:45 +0100
commit3e83d73f272afe8de85189da7d6d513916cc2efd (patch)
tree299467eb07a1f9465d21038cac145eef66aea528
parent7b811deeffc762f8370b4cf7e8a353fd516d6543 (diff)
downloadNim-3e83d73f272afe8de85189da7d6d513916cc2efd.tar.gz
compiler: Handle nkCheckedFieldExpr better in dfa (#19616)
Simply recurse into their first child, which is always
a nkDotExpr instead of treating them seperately.
This fixes the rhs sym of a nkCheckedFieldExpr being
checked twice in aliases. This double checking didn't
cause any issues, but was unintentional and redundant.
-rw-r--r--compiler/dfa.nim6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/dfa.nim b/compiler/dfa.nim
index 0539f6699..d68e7be82 100644
--- a/compiler/dfa.nim
+++ b/compiler/dfa.nim
@@ -605,11 +605,11 @@ proc aliases*(obj, field: PNode): AliasKind =
     var n = n
     while true:
       case n.kind
-      of PathKinds0 - {nkDotExpr, nkCheckedFieldExpr, nkBracketExpr}:
+      of PathKinds0 - {nkDotExpr, nkBracketExpr}:
         n = n[0]
       of PathKinds1:
         n = n[1]
-      of nkDotExpr, nkCheckedFieldExpr, nkBracketExpr:
+      of nkDotExpr, nkBracketExpr:
         result.add n
         n = n[0]
       of nkSym:
@@ -642,8 +642,6 @@ proc aliases*(obj, field: PNode): AliasKind =
       if currFieldPath.sym != currObjPath.sym: return no
     of nkDotExpr:
       if currFieldPath[1].sym != currObjPath[1].sym: return no
-    of nkCheckedFieldExpr:
-      if currFieldPath[0][1].sym != currObjPath[0][1].sym: return no
     of nkBracketExpr:
       if currFieldPath[1].kind in nkLiterals and currObjPath[1].kind in nkLiterals:
         if currFieldPath[1].intVal != currObjPath[1].intVal: