mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
Merge pull request #8996 from LemonBoy/fix-2574
The VM cannot call methods
This commit is contained in:
@@ -1842,6 +1842,9 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
|
||||
let s = n.sons[0].sym
|
||||
if s.magic != mNone:
|
||||
genMagic(c, n, dest, s.magic)
|
||||
elif s.kind == skMethod:
|
||||
localError(c.config, n.info, "cannot call method " & s.name.s &
|
||||
" at compile time")
|
||||
elif matches(s, "stdlib", "marshal", "to"):
|
||||
# XXX marshal load&store should not be opcodes, but use the
|
||||
# general callback mechanisms.
|
||||
|
||||
14
tests/vm/t2574.nim
Normal file
14
tests/vm/t2574.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
line: 14
|
||||
errormsg: "cannot call method eval at compile time"
|
||||
"""
|
||||
|
||||
type
|
||||
PExpr = ref object of RootObj
|
||||
|
||||
method eval(e: PExpr): int =
|
||||
discard
|
||||
|
||||
static:
|
||||
let x = PExpr()
|
||||
discard x.eval
|
||||
Reference in New Issue
Block a user