mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Adds idetools testcase for dynamic dispatch. Refs #477.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -171,6 +171,7 @@ examples/cross_calculator/android/tags
|
||||
/tests/caas/imported
|
||||
/tests/caas/issue_416_template_shift
|
||||
/tests/caas/issue_452_export_shift
|
||||
/tests/caas/issue_477_dynamic_dispatch
|
||||
/tests/caas/main
|
||||
/tests/caasdriver
|
||||
/tools/nimgrep
|
||||
|
||||
19
tests/caas/issue_477_dynamic_dispatch.nim
Normal file
19
tests/caas/issue_477_dynamic_dispatch.nim
Normal file
@@ -0,0 +1,19 @@
|
||||
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 "collide1"
|
||||
|
||||
method collide(a: TUnit, b: TThing) {.inline.} =
|
||||
echo "collide2"
|
||||
|
||||
var
|
||||
a, b: TUnit
|
||||
|
||||
when isMainModule:
|
||||
collide(a, b) # output: 2
|
||||
5
tests/caas/issue_477_dynamic_dispatch.txt
Normal file
5
tests/caas/issue_477_dynamic_dispatch.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
issue_477_dynamic_dispatch.nim
|
||||
> c --run
|
||||
SuccessX
|
||||
> idetools --track:issue_477_dynamic_dispatch.nim,19,5 --def
|
||||
def\tskMethod\tissue_477_dynamic_dispatch.collide\tproc \(TUnit, TThing\)\{.inline.\}
|
||||
Reference in New Issue
Block a user