summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorzah <zahary@gmail.com>2020-03-26 10:26:19 +0200
committerGitHub <noreply@github.com>2020-03-26 09:26:19 +0100
commite50441ab33d1b287a89ad4e2d795c80b7f8077c0 (patch)
tree3cb06dd6cf0018a57eb12c65a6565fda60ccebd6 /compiler/semstmts.nim
parent1b31e08917f3644b80a10b581089b816ef2db214 (diff)
downloadNim-e50441ab33d1b287a89ad4e2d795c80b7f8077c0.tar.gz
Fix typeSym.getImpl for ref types (#13752)
* Fix typeSym.getImpl for ref types

* Fix a codegen issue affecting the test suite of nim-beacon-chain

* Fix tests/stdlib/tjsonmacro

To understand the fix better it may help to take a look
at the history of the replaced code.

The nil check that is removed in this commit was introduced
in another fix that failed to identify the root cause of the
issue - namely that we allow an object type to exist for which
no ast is present:

https://github.com/nim-lang/Nim/pull/9601/files

The original intention of the code is more obvious here:

https://github.com/nim-lang/Nim/pull/9538/files
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 6b01e241b..5232c5706 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1279,12 +1279,12 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
       incl st.flags, tfRefsAnonObj
       let obj = newSym(skType, getIdent(c.cache, s.name.s & ":ObjectType"),
                               getCurrOwner(c), s.info)
+      obj.ast = a
       if sfPure in s.flags:
         obj.flags.incl sfPure
       obj.typ = st.lastSon
       st.lastSon.sym = obj
 
-
 proc checkForMetaFields(c: PContext; n: PNode) =
   proc checkMeta(c: PContext; n: PNode; t: PType) =
     if t != nil and t.isMetaType and tfGenericTypeParam notin t.flags: