Skip to content

Commit

Permalink
fixes #9600 (#9601)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn authored and krux02 committed Nov 7, 2018
1 parent b9cdad7 commit fc740c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/vmdeps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
of tyObject:
if inst:
result = newNodeX(nkObjectTy)
result.add t.sym.ast[2][0].copyTree # copy object pragmas
if t.sym.ast != nil:
result.add t.sym.ast[2][0].copyTree # copy object pragmas
else:
result.add newNodeI(nkEmpty, info)
if t.sons[0] == nil:
result.add newNodeI(nkEmpty, info)
else: # handle parent object
Expand Down
11 changes: 11 additions & 0 deletions tests/macros/tgettypeinst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,14 @@ test(MyObj):
_ = object {.packed,myAttr,serializationKey: "one".}
myField: int
myField2: float

block t9600:
type
Apple = ref object of RootObj

macro mixer(x: typed): untyped =
let w = getType(x)
let v = getTypeImpl(w[1])

var z: Apple
mixer(z)

0 comments on commit fc740c5

Please sign in to comment.