fix dispatcher call type [backport] (#20696)

fix dispatcher call type

The call node should have the type of the dispatcher, not the static
call
This commit is contained in:
Jacek Sieka 2022-10-29 18:12:19 +02:00 • committed by GitHub
commit f8b5464f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,6 +50,7 @@ proc methodCall*(n: PNode; conf: ConfigRef): PNode =
# replace ordinary method by dispatcher method: # replace ordinary method by dispatcher method:
let disp = getDispatcher(result[0].sym) let disp = getDispatcher(result[0].sym)
if disp != nil: if disp != nil:
result[0].typ = disp.typ
result[0].sym = disp result[0].sym = disp
# change the arguments to up/downcasts to fit the dispatcher's parameters: # change the arguments to up/downcasts to fit the dispatcher's parameters:
for i in 1..<result.len: for i in 1..<result.len: