From 55e858010b9ba53c27475d9ce6f864a84d28fa81 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 14 Jul 2018 18:30:28 +0200 Subject: Resolve function overload via the argument reversal to untyped --- unit-tests/function/call.test | 19 ++++++++++++++++++- unit-tests/function/driver.cxx | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'unit-tests') diff --git a/unit-tests/function/call.test b/unit-tests/function/call.test index 127af24..3dd9a85 100644 --- a/unit-tests/function/call.test +++ b/unit-tests/function/call.test @@ -74,6 +74,23 @@ buildfile:1:2: error: ambiguous call to ambig() /)) EOE +: unmatched +: +$* <'$ambig(abc, def)' 2>>~/EOE/ != 0 +buildfile:1:2: error: unmatched call to ambig(, ) +/(( + info: candidate: ambig( [, uint64]), qualified name dummy.ambig + info: candidate: ambig( [, string]), qualified name dummy.ambig +/)|( + info: candidate: ambig( [, string]), qualified name dummy.ambig + info: candidate: ambig( [, uint64]), qualified name dummy.ambig +/)) +EOE + +: reverse +: +$* <'print $reverse([string] abc)' >'abc' + : optional-absent : $* <'print $optional()' >'true' @@ -118,7 +135,7 @@ EOE : print-fovl : $* <'$ambig([bool] true)' 2>>~/EOE/ != 0 -buildfile:1:2: error: unmatched call to ambig(bool) +buildfile:1:2: error: ambiguous call to ambig(bool) /(( info: candidate: ambig( [, uint64]), qualified name dummy.ambig info: candidate: ambig( [, string]), qualified name dummy.ambig diff --git a/unit-tests/function/driver.cxx b/unit-tests/function/driver.cxx index e97596a..393b456 100644 --- a/unit-tests/function/driver.cxx +++ b/unit-tests/function/driver.cxx @@ -54,6 +54,8 @@ namespace build2 f["ambig"] = [](names a, optional) {return a;}; f["ambig"] = [](names a, optional) {return a;}; + f["reverse"] = [](names a) {return a;}; + f["scoped"] = [](const scope*, names a) {return a;}; f["scoped_void"] = [](const scope*, names) {}; f["scoped"] = &scoped; -- cgit v1.1