Files
Nim/tests/objects/trefobjfieldoverload.nim
metagn 2529f33760 remove inserted derefs for ref object fields when transforming to dot call (#24498)
fixes #24492

Kind of a goofy way of doing this, but we count how many derefs were
used for the first parameter before calling `builtinFieldAccess`, then
count after, and if there are more now than before, we remove the added
derefs. I thought maybe getting rid of #18298 would simplify it but
maybe this would still be the best way.

For better encapsulation we could make `dotTransformation` take an
`nOrig` param instead but this would be less efficient since it would
need a copy, though `semAsgn` already makes one.
2024-12-04 12:16:37 +08:00

7 lines
119 B
Nim

block: # issue #24492
type MyType = ref object
a: int
proc a(val: MyType, i: int) = discard
MyType().a(100)