mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
…er base method returning a lent
fixes #22673
(cherry picked from commit 2e070dfc76)
This commit is contained in:
21
tests/method/t22673.nim
Normal file
21
tests/method/t22673.nim
Normal file
@@ -0,0 +1,21 @@
|
||||
discard """
|
||||
matrix: "--warningAsError:UseBase"
|
||||
"""
|
||||
|
||||
# bug #22673
|
||||
type RefEntry = ref object of RootObj
|
||||
|
||||
type RefFile = ref object of RefEntry
|
||||
filename*: string
|
||||
data*: string
|
||||
|
||||
type RefDir = ref object of RefEntry
|
||||
dirname*: string
|
||||
files*: seq[RefFile]
|
||||
|
||||
method name*(e: RefEntry): lent string {.base.} =
|
||||
raiseAssert "Don't call the base method"
|
||||
|
||||
method name*(e: RefFile): lent string = e.filename
|
||||
|
||||
method name*(e: RefDir): lent string = e.dirname
|
||||
Reference in New Issue
Block a user