From 33458894da13da7134604639c129273bfb0cb1c1 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 9 Oct 2018 19:58:23 +0200 Subject: Fix overload resolution for pragmas evaluation (#8902) Fixes #6448 Fixes #4384 --- tests/macros/tmsginfo.nim | 2 +- tests/pragmas/foobar.nim | 3 +++ tests/pragmas/t4384.nim | 3 +++ tests/pragmas/t6448.nim | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/pragmas/foobar.nim create mode 100644 tests/pragmas/t4384.nim create mode 100644 tests/pragmas/t6448.nim (limited to 'tests') diff --git a/tests/macros/tmsginfo.nim b/tests/macros/tmsginfo.nim index bf6c9d537..ebdce0155 100644 --- a/tests/macros/tmsginfo.nim +++ b/tests/macros/tmsginfo.nim @@ -1,6 +1,6 @@ discard """ nimout: '''tmsginfo.nim(21, 1) Warning: foo1 [User] -tmsginfo.nim(22, 11) template/generic instantiation from here +tmsginfo.nim(22, 13) template/generic instantiation from here tmsginfo.nim(15, 10) Warning: foo2 [User] tmsginfo.nim(23, 1) Hint: foo3 [User] tmsginfo.nim(19, 7) Hint: foo4 [User] diff --git a/tests/pragmas/foobar.nim b/tests/pragmas/foobar.nim new file mode 100644 index 000000000..46032e187 --- /dev/null +++ b/tests/pragmas/foobar.nim @@ -0,0 +1,3 @@ +import macros +macro async*(body: untyped): untyped = + return newStmtList() diff --git a/tests/pragmas/t4384.nim b/tests/pragmas/t4384.nim new file mode 100644 index 000000000..e6b193f79 --- /dev/null +++ b/tests/pragmas/t4384.nim @@ -0,0 +1,3 @@ +macro testMacro(body: untyped): untyped = discard +macro testMacro(s: string, body: untyped): untyped = discard +proc foo() {.testMacro: "foo".} = discard diff --git a/tests/pragmas/t6448.nim b/tests/pragmas/t6448.nim new file mode 100644 index 000000000..61e4a35d9 --- /dev/null +++ b/tests/pragmas/t6448.nim @@ -0,0 +1,16 @@ +discard """ + line: 9 + errormsg: '''ambiguous call; both foobar.async''' +""" + +import foobar +import asyncdispatch, macros + +proc bar() {.async.} = + echo 42 + +proc foo() {.async.} = + await bar() + +asyncCheck foo() +runForever() -- cgit 1.4.1-2-gfad0