summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-06-13 13:04:24 +0300
committerGitHub <noreply@github.com>2023-06-13 12:04:24 +0200
commitfda8b6f193e2e229488f76f18089f01eb08272fb (patch)
treeae3430a6bcfaa71060a89143b04c4cc381be15b1 /tests
parent2e12d3e26bd39205a2aa61a8873173e579cbcb9e (diff)
downloadNim-fda8b6f193e2e229488f76f18089f01eb08272fb.tar.gz
strictly typecheck expressions in bracketed `emit` (#22074)
* strictly typecheck expressions in bracketed `emit`

* use nim check in test
Diffstat (limited to 'tests')
-rw-r--r--tests/lookups/tambiguousemit.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/lookups/tambiguousemit.nim b/tests/lookups/tambiguousemit.nim
new file mode 100644
index 000000000..0ebd0a255
--- /dev/null
+++ b/tests/lookups/tambiguousemit.nim
@@ -0,0 +1,12 @@
+discard """
+  cmd: "nim check $options $file" # use check to assure error is pre-codegen
+  matrix: "; --backend:js" # backend shouldn't matter but at least check js
+"""
+
+proc foo(x: int) = discard
+proc foo(x: float) = discard
+
+{.emit: ["// ", foo].} #[tt.Error
+                ^ ambiguous identifier 'foo' -- use one of the following:
+  tambiguousemit.foo: proc (x: int){.noSideEffect, gcsafe.}
+  tambiguousemit.foo: proc (x: float){.noSideEffect, gcsafe.}]#