From 6a37c0682ad30701aeef22e146d5cd5bff33b830 Mon Sep 17 00:00:00 2001 From: flywind <43030857+xflywind@users.noreply.github.com> Date: Mon, 23 Nov 2020 04:01:17 +0800 Subject: [PATCH] ast minor (#16079) --- compiler/ast.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/ast.nim b/compiler/ast.nim index c75a149c02..da3f3e7d75 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1834,6 +1834,7 @@ proc toVar*(typ: PType; kind: TTypeKind; idgen: IdGenerator): PType = proc toRef*(typ: PType; idgen: IdGenerator): PType = ## If ``typ`` is a tyObject then it is converted into a `ref ` and ## returned. Otherwise ``typ`` is simply returned as-is. + result = typ if typ.skipTypes({tyAlias, tyGenericInst}).kind == tyObject: result = newType(tyRef, nextId(idgen), typ.owner) rawAddSon(result, typ)