From b15f585273092f05145dd5b3fec5e83e27fbe45a Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Sun, 16 Jun 2013 13:18:09 +0200 Subject: Adds idetoos testcase to verify returned signatures. At the moment too many of them return proc. --- .gitignore | 2 +- tests/caas/its_full_of_procs.nim | 29 +++++++++++++++++++++++++++++ tests/caas/its_full_of_procs.txt | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/caas/its_full_of_procs.nim create mode 100644 tests/caas/its_full_of_procs.txt diff --git a/.gitignore b/.gitignore index a52319eff..dcb94935f 100644 --- a/.gitignore +++ b/.gitignore @@ -173,7 +173,7 @@ examples/cross_calculator/android/tags /tests/caas/issue_416_template_shift /tests/caas/issue_452_export_shift /tests/caas/issue_477_dynamic_dispatch +/tests/caas/its_full_of_procs /tests/caas/main /tests/caasdriver /tools/nimgrep -no changes added to commit (use "git add" and/or "git commit -a") diff --git a/tests/caas/its_full_of_procs.nim b/tests/caas/its_full_of_procs.nim new file mode 100644 index 000000000..45347490c --- /dev/null +++ b/tests/caas/its_full_of_procs.nim @@ -0,0 +1,29 @@ +import unicode, sequtils + +# This example shows that idetools returns proc as signature for everything +# which can be called. While a clever person would use the second column to +# differentiate betwen procs, methods and others, why does the output contain +# incorrect information? + +type + TThing = object of TObject + TUnit = object of TThing + x: int + +method collide(a, b: TThing) {.inline.} = + quit "to override!" + +method collide(a: TThing, b: TUnit) {.inline.} = + echo "1" + +method collide(a: TUnit, b: TThing) {.inline.} = + echo "2" + +var + a, b: TUnit + +let + input = readFile("its_full_of_procs.nim") + letters = toSeq(runes(string(input))) + +collide(a, b) # output: 2 diff --git a/tests/caas/its_full_of_procs.txt b/tests/caas/its_full_of_procs.txt new file mode 100644 index 000000000..31a2d3baa --- /dev/null +++ b/tests/caas/its_full_of_procs.txt @@ -0,0 +1,20 @@ +its_full_of_procs.nim + +> idetools --track:$TESTNIM,26,15 --def $SILENT +skProc +proc \( + +> idetools --track:$TESTNIM,27,21 --def $SILENT +skIterator +iterator \( +!proc \( + +> idetools --track:$TESTNIM,29,0 --def $SILENT +skMethod +method \( +!proc \( + +> idetools --track:$TESTNIM,27,15 --def $SILENT +skTemplate +template \( +!proc \( -- cgit 1.4.1-2-gfad0