mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
Adds idetoos testcase to verify returned signatures.
At the moment too many of them return proc.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -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")
|
||||
|
||||
29
tests/caas/its_full_of_procs.nim
Normal file
29
tests/caas/its_full_of_procs.nim
Normal file
@@ -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
|
||||
20
tests/caas/its_full_of_procs.txt
Normal file
20
tests/caas/its_full_of_procs.txt
Normal file
@@ -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 \(
|
||||
Reference in New Issue
Block a user