diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-20 23:45:31 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-20 23:45:31 +0200 |
commit | 09bda74e7d3cbc5e606be6c4b6c68230013948e3 (patch) | |
tree | 44e910e8da6efe2ead5917af30f92e20884be2c0 /compiler | |
parent | 8ba062d952f1bb4e8330bb7f5f04c2cd949e29b3 (diff) | |
download | Nim-09bda74e7d3cbc5e606be6c4b6c68230013948e3.tar.gz |
fix #1015
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index b8c4f3297..b3b757640 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -931,7 +931,9 @@ proc makeDeref(n: PNode): PNode = addSon(result, a) t = skipTypes(t.sons[0], {tyGenericInst}) -const tyTypeParamsHolders = {tyGenericInst, tyCompositeTypeClass} +const + tyTypeParamsHolders = {tyGenericInst, tyCompositeTypeClass} + tyDotOpTransparent = {tyVar, tyPtr, tyRef} proc readTypeParameter(c: PContext, typ: PType, paramName: PIdent, info: TLineInfo): PNode = @@ -968,6 +970,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = result = nil if isTypeExpr(n.sons[0]) or (ty.kind == tyTypeDesc and ty.base.kind != tyNone): if ty.kind == tyTypeDesc: ty = ty.base + ty = ty.skipTypes(tyDotOpTransparent) case ty.kind of tyEnum: # look up if the identifier belongs to the enum: @@ -1031,8 +1034,10 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = result = n # we didn't find any field, let's look for a generic param - if result == nil and n.sons[0].typ.kind in tyTypeParamsHolders: - result = readTypeParameter(c, n.sons[0].typ, i, n.info) + if result == nil: + let t = n.sons[0].typ.skipTypes(tyDotOpTransparent) + if t.kind in tyTypeParamsHolders: + result = readTypeParameter(c, t, i, n.info) proc dotTransformation(c: PContext, n: PNode): PNode = if isSymChoice(n.sons[1]): |