fixes #20515; base method requires explicit {.gcsafe.} to be GC-safe (#20574)

* fixes #20515; base requires explicit `{.gcsafe.}` to be GC-safe

* add tests
This commit is contained in:
ringabout 2022-10-16 19:20:05 +08:00 • committed by GitHub
commit 0bacdf5fdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 4 deletions

20
tests/method/t20515.nim Normal file
View file

@ -0,0 +1,20 @@
discard """
errormsg: "Base method 'zzz' requires explicit '{.gcsafe.}' to be GC-safe"
line: 10
"""
type
A = ref object of RootObj
B = ref object of A
method zzz(a: A) {.base.} =
discard
var s: seq[int]
method zzz(a: B) =
echo s
proc xxx(someObj: A) {.gcsafe.} =
someObj.zzz()
xxx(B())