Fixes 8616 (#8617)

* Don't leave dangling forward references to types

Fixes #8616

* Add a test case for #8616
This commit is contained in:
LemonBoy 2018-08-12 20:43:30 +02:00 • committed by Andreas Rumpf
commit 3cb963f114
4 changed files with 17 additions and 1 deletions

View file

@ -1130,8 +1130,8 @@ proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) =
patchAsgnStmtListExpr(patchedTree, e, ri) patchAsgnStmtListExpr(patchedTree, e, ri)
genStmts(p, patchedTree) genStmts(p, patchedTree)
return return
var a: TLoc var a: TLoc
discard getTypeDesc(p.module, le.typ.skipTypes(skipPtrs))
if le.kind in {nkDerefExpr, nkHiddenDeref}: if le.kind in {nkDerefExpr, nkHiddenDeref}:
genDeref(p, le, a, enforceDeref=true) genDeref(p, le, a, enforceDeref=true)
else: else:

View file

@ -0,0 +1,2 @@
proc head*[T](pp: var array[1,T]): var T =
result = pp[0]

View file

@ -0,0 +1,10 @@
import rtarray
type
T = tuple[x:int]
var
arr: array[1,T]
proc init*() =
discard head(arr)

4
tests/ccgbugs/t8616.nim Normal file
View file

@ -0,0 +1,4 @@
import pkg8616 / scheduler
when isMainModule:
init()