diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim index 3dfd71315fb3f..83d40c00676ea 100644 --- a/compiler/sighashes.nim +++ b/compiler/sighashes.nim @@ -179,6 +179,9 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) = # make the hash different from the one we produce by hashing only the # type name. c &= ".empty" + else: + if sfCompilerProc notin t.sym.flags: + c &= t.id else: c &= t.id if t.len > 0 and t[0] != nil: diff --git a/tests/modules/module1/defs.nim b/tests/modules/module1/defs.nim new file mode 100644 index 0000000000000..36a8c50443e89 --- /dev/null +++ b/tests/modules/module1/defs.nim @@ -0,0 +1,2 @@ +type MyObj* = object + field1*: int diff --git a/tests/modules/module2/defs.nim b/tests/modules/module2/defs.nim new file mode 100644 index 0000000000000..e4085a88645fd --- /dev/null +++ b/tests/modules/module2/defs.nim @@ -0,0 +1,2 @@ +type MyObj* = object + field2*: int diff --git a/tests/modules/tmoduleconflict.nim b/tests/modules/tmoduleconflict.nim new file mode 100644 index 0000000000000..24ba2b13fd86a --- /dev/null +++ b/tests/modules/tmoduleconflict.nim @@ -0,0 +1,6 @@ +import module1/defs as md1 +import module2/defs as md2 + +let x = md1.MyObj(field1: 1) +let y = md2.MyObj(field2: 1) +doAssert x.field1 == y.field2