From fda8b6f193e2e229488f76f18089f01eb08272fb Mon Sep 17 00:00:00 2001 From: metagn Date: Tue, 13 Jun 2023 13:04:24 +0300 Subject: strictly typecheck expressions in bracketed `emit` (#22074) * strictly typecheck expressions in bracketed `emit` * use nim check in test --- tests/lookups/tambiguousemit.nim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/lookups/tambiguousemit.nim (limited to 'tests/lookups/tambiguousemit.nim') 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.}]# -- cgit 1.4.1-2-gfad0