- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.5k
 
fixes #20139; hash types based on its path relative to its package path #21274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
           Seems excessive, isn't there an easier way?  | 
    
| 
           @ringabout How about including  Here is what I tried: +template includeIdHash(c: var MD5Context, s: PSym) =
+  # Include the symbol ID to disambiguate symbols with identical names and
+  # identical module names. (bug #20139)
+  c &= hash(s.itemId)
proc hashSym(c: var MD5Context, s: PSym) =
+  includeIdHash(c, s)
  if sfAnon in s.flags or s.kind == skGenericParam:
    c &= ":anon"
  else:
    var it = s
    while it != nil:
      c &= it.name.s
      c &= "."
      it = it.owner
proc hashTypeSym(c: var MD5Context, s: PSym) =
+  includeIdHash(c, s)
  if sfAnon in s.flags or s.kind == skGenericParam:
    c &= ":anon"
  else:
    var it = s
    while it != nil:
      if sfFromGeneric in it.flags and it.kind in routineKinds and
          it.typ != nil:
        hashType c, it.typ, {CoProc}
      c &= it.name.s
      c &= "."
      it = it.owner | 
    
| 
           I'm not sure whether it is consistent enough, see also #20564 (comment)  | 
    
| 
           @Araq Could we use what @quantimnot suggested or is there another way out?  | 
    
| 
           My own "superior" solution ended up being nearly identical... :-)  | 
    
| 
           a backport to 1.6 would be appreciated here - this completely cripples 1.6 both compile-time and runtime depending on the shape of objects  | 
    
| 
           "path relative to its package path" is still wrong or at least inflexible. --> Wait for my change on top of this PR.  | 
    
| 
           Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release  | 
    
This reverts commit 442d8d0.
…ckage path (nim-lang#21274) [backport:1.6] * fixes nim-lang#20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 38d299d)
…th (#21274) [backport:1.6] * fixes #20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <[email protected]> (cherry picked from commit 38d299d)
…ckage path (nim-lang#21274) [backport:1.6] * fixes nim-lang#20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <[email protected]>
…ckage path (nim-lang#21274) [backport:1.6] * fixes nim-lang#20139; hash types based on its path relative its project * add a test case * fixes procs * better implementation and test case --------- Co-authored-by: Andreas Rumpf <[email protected]>
fixes #20139
hashTypeSymis used to calculate the hash of a type symbol. To differentiate modules with the same name but in the different paths of a package, we can consider its relative path to its package path.