diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-04-07 16:58:17 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2017-04-07 17:03:49 +0300 |
commit | eb635d9ccf4abb9a003808ed1ddce889ecd982ef (patch) | |
tree | ba94a7dd784cda2d7b481b1841000b66c572fe92 /compiler | |
parent | ee4b98ec17ba7221f864a40ba5d25f63821987cb (diff) | |
download | Nim-eb635d9ccf4abb9a003808ed1ddce889ecd982ef.tar.gz |
fix #5648
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtypes.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 422d2f0fa..5bc9bbd78 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -135,7 +135,9 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = let isCall = ord(n.kind in nkCallKinds+{nkBracketExpr}) let n = if n[0].kind == nkBracket: n[0] else: n checkMinSonsLen(n, 1) - var base = semTypeNode(c, n.lastSon, nil).skipTypes({tyTypeDesc}) + var t = semTypeNode(c, n.lastSon, nil) + if t.kind == tyTypeDesc and tfUnresolved notin t.flags: + t = t.base result = newOrPrevType(kind, prev, c) var isNilable = false # check every except the last is an object: @@ -149,7 +151,7 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType = tyError, tyObject}: message n[i].info, errGenerated, "region needs to be an object type" addSonSkipIntLit(result, region) - addSonSkipIntLit(result, base) + addSonSkipIntLit(result, t) #if not isNilable: result.flags.incl tfNotNil proc semVarType(c: PContext, n: PNode, prev: PType): PType = |