Closed Parashurama closed 8 years ago
Following on this issue
It seems to me that the following should to be the solution since their common ancestor doesn't have 'dummy_method'. But this doesn't work either! error: main_module.nim(18, 8) Error: method is not a base
Is this another bug or something i missed?
type
BaseEvent* = object of RootObj
data:pointer
Control* = object of RootObj
state: bool
Button* = object of Control
is_clicked : bool
Dialog* = object of Control
content: seq[RootObj]
method dummy_event*(self: Button, ev: BaseEvent) : bool {.base.} =
discard
method dummy_event*(self: Dialog, ev: BaseEvent) : bool {.base.} =
discard
Whatever the compiler implements, it has to be consistent (right now it isn't) and in the spec.
So, how this problem could be solved? Any workaround?
type
ByteArray* = ref object of RootObj
OutputStream* = ref object of RootObj
method CopyTo*(ba, target: ByteArray): int = discard
method CopyTo*(ba: ByteArray, os: OutputStream): int = discard
this is perhaps related with the above issue the above code produce error message:
bytearray.nim(5, 8) Warning: use {.base.} for base methods; baseless methods are
deprecated [UseBase]
bytearray.nim(5, 20) Error: there is no subtype relation between OutputStream an
d ByteArray
ver 0.11.2: compile success 0.12.0: failed with ICE 0.12.1: failed with no subtype relation
if the target
param removed(which is undesired), no error
the following code create a compiler error:
Error: internal error: cgmeth.genConv No stack traceback available To create a stacktrace, rerun compilation with ./koch temp c
main_module.nim(21, 21) Error: internal error: cgmeth.genConv
Traceback (most recent call last)
nim.nim(107) nim
nim.nim(71) handleCmdLine
main.nim(251) mainCommand
main.nim(63) commandCompileToC
modules.nim(221) compileProject
modules.nim(169) compileModule
passes.nim(206) processModule
passes.nim(129) closePasses
cgen.nim(1310) myClose
cgmeth.nim(259) generateMethodDispatchers
cgmeth.nim(231) genDispatcher
cgmeth.nim(21) genConv
msgs.nim(991) internalError
msgs.nim(965) liMessage
msgs.nim(837) handleError
msgs.nim(821) quit
FAILURE
VERSION: Nim Compiler Version 0.12.1 (2015-11-15) [Linux: amd64] Copyright (c) 2006-2015 by Andreas Rumpf
git hash: 0f7fdd8bf4d4f747f01c4d95ce64d96763286afc active boot switches: -d:release
the problem disappear if BaseEvent changed to 'int' or another basic type but warn that second 'dummy_event' should have 'base' pragma.
Also the compiler doesn't accept 'base' pragma on second method if both arguments are objects