summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/sighashes.nim5
-rw-r--r--tests/template/tconfusinglocal.nim4
-rw-r--r--tests/template/tsighash_regression.nim5
3 files changed, 14 insertions, 0 deletions
diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim
index e7737e44a..145d3ff5a 100644
--- a/compiler/sighashes.nim
+++ b/compiler/sighashes.nim
@@ -281,6 +281,11 @@ proc hashNonProc*(s: PSym): SigHash =
     c &= it.name.s
     c &= "."
     it = it.owner
+  # for bug #5135 we also take the position into account, but only
+  # for parameters, because who knows what else position dependency
+  # might cause:
+  if s.kind == skParam:
+    c &= s.position
   md5Final c, result.Md5Digest
 
 proc hashOwner*(s: PSym): SigHash =
diff --git a/tests/template/tconfusinglocal.nim b/tests/template/tconfusinglocal.nim
index 9b2cdc954..50bf8f4b2 100644
--- a/tests/template/tconfusinglocal.nim
+++ b/tests/template/tconfusinglocal.nim
@@ -1,4 +1,8 @@
 
+# bug #5135
+proc fail*[E](e: E): void =
+  raise newException(Exception, e)
+
 # bug #4875
 type Bar = object
     mFoo: int
diff --git a/tests/template/tsighash_regression.nim b/tests/template/tsighash_regression.nim
new file mode 100644
index 000000000..bf1f4dfe4
--- /dev/null
+++ b/tests/template/tsighash_regression.nim
@@ -0,0 +1,5 @@
+
+import tconfusinglocal
+
+
+fail "foo"