fixes #5439
This commit is contained in:
parent
53f4bdad23
commit
fb37d13f46
2 changed files with 32 additions and 4 deletions
|
|
@ -1377,9 +1377,10 @@ proc myClose(graph: ModuleGraph; b: PPassContext, n: PNode): PNode =
|
||||||
registerModuleToMain(m.g, m.module)
|
registerModuleToMain(m.g, m.module)
|
||||||
|
|
||||||
if sfMainModule in m.module.flags:
|
if sfMainModule in m.module.flags:
|
||||||
incl m.flags, objHasKidsValid
|
if m.g.forwardedProcsCounter == 0:
|
||||||
var disp = generateMethodDispatchers(graph)
|
incl m.flags, objHasKidsValid
|
||||||
for i in 0..sonsLen(disp)-1: genProcAux(m, disp.sons[i].sym)
|
let disp = generateMethodDispatchers(graph)
|
||||||
|
for x in disp: genProcAux(m, x.sym)
|
||||||
genMainProc(m)
|
genMainProc(m)
|
||||||
|
|
||||||
proc cgenWriteModules*(backend: RootRef, config: ConfigRef) =
|
proc cgenWriteModules*(backend: RootRef, config: ConfigRef) =
|
||||||
|
|
|
||||||
27
tests/ccgbugs/twrong_method.nim
Normal file
27
tests/ccgbugs/twrong_method.nim
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
discard """
|
||||||
|
cmd: "nim c -d:release $file"
|
||||||
|
output: '''correct method'''
|
||||||
|
"""
|
||||||
|
# bug #5439
|
||||||
|
type
|
||||||
|
Control* = ref object of RootObj
|
||||||
|
|
||||||
|
ControlImpl* = ref object of Control
|
||||||
|
|
||||||
|
Container* = ref object of ControlImpl
|
||||||
|
|
||||||
|
ContainerImpl* = ref object of Container
|
||||||
|
|
||||||
|
method testProc*(control: Control) {.base.} = echo "wrong method"
|
||||||
|
|
||||||
|
method testProc*(container: Container) = echo "correct method"
|
||||||
|
|
||||||
|
proc main()
|
||||||
|
|
||||||
|
main() # wrong method called
|
||||||
|
|
||||||
|
proc main() =
|
||||||
|
var container = new ContainerImpl
|
||||||
|
container.testProc()
|
||||||
|
|
||||||
|
# main() # correct method called
|
||||||
Loading…
Add table
Add a link
Reference in a new issue