mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
added missing test
This commit is contained in:
30
tests/method/tmapper.nim
Normal file
30
tests/method/tmapper.nim
Normal file
@@ -0,0 +1,30 @@
|
||||
discard """
|
||||
errormsg: "invalid declaration order; cannot attach 'step' to method defined here: tmapper.nim(22,7)"
|
||||
line: 25
|
||||
"""
|
||||
|
||||
# bug #2590
|
||||
|
||||
type
|
||||
Console* = ref object
|
||||
mapper*: Mapper
|
||||
|
||||
Mapper* = ref object of RootObj
|
||||
|
||||
Mapper2* = ref object of Mapper
|
||||
|
||||
proc newMapper2*: Mapper2 =
|
||||
new result
|
||||
|
||||
proc newMapper*: Mapper =
|
||||
result = newMapper2()
|
||||
|
||||
method step*(m: Mapper2) {.base.} =
|
||||
echo "Mapper2"
|
||||
|
||||
method step*(m: Mapper) {.base.} =
|
||||
echo "Mapper"
|
||||
|
||||
var console = Console()
|
||||
console.mapper = newMapper()
|
||||
console.mapper.step()
|
||||
Reference in New Issue
Block a user