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
This commit is contained in:
zah 2020-03-26 10:26:19 +02:00 • committed by GitHub
commit e50441ab33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 8 deletions

View file

@ -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: