fixes #12488 [backport]
This commit is contained in:
parent
2dea920379
commit
87f0d534d6
2 changed files with 21 additions and 1 deletions
|
|
@ -2129,6 +2129,9 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) =
|
||||||
genTypeLit(c, n.typ, dest)
|
genTypeLit(c, n.typ, dest)
|
||||||
of nkComesFrom:
|
of nkComesFrom:
|
||||||
discard "XXX to implement for better stack traces"
|
discard "XXX to implement for better stack traces"
|
||||||
|
else:
|
||||||
|
if n.typ != nil and n.typ.isCompileTimeOnly:
|
||||||
|
genTypeLit(c, n.typ, dest)
|
||||||
else:
|
else:
|
||||||
globalError(c.config, n.info, "cannot generate VM code for " & $n)
|
globalError(c.config, n.info, "cannot generate VM code for " & $n)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ Done!
|
||||||
foo4
|
foo4
|
||||||
foo4
|
foo4
|
||||||
foo4
|
foo4
|
||||||
|
(a: 0, b: 0)
|
||||||
|
(a: 0, b: 0)
|
||||||
|
(a: 0, b: 0)
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -234,3 +237,17 @@ static:
|
||||||
echo foo()
|
echo foo()
|
||||||
echo foo()
|
echo foo()
|
||||||
echo foo()
|
echo foo()
|
||||||
|
|
||||||
|
# bug #12488
|
||||||
|
type
|
||||||
|
MyObject = object
|
||||||
|
a,b: int
|
||||||
|
MyObjectRef = ref MyObject
|
||||||
|
|
||||||
|
static:
|
||||||
|
let x1 = new(MyObject)
|
||||||
|
echo x1[]
|
||||||
|
let x2 = new(MyObjectRef)
|
||||||
|
echo x2[]
|
||||||
|
let x3 = new(ref MyObject) # cannot generate VM code for ref MyObject
|
||||||
|
echo x3[]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue