diff options
author | Zahary Karadjov <zahary@gmail.com> | 2013-08-19 01:17:07 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2013-08-19 01:17:07 +0300 |
commit | f127bc387a8e45635a9e4aa9208df4c8e8c0f276 (patch) | |
tree | e419605536a1cc1d3bcd14fe40c7b2f1f740e2fe /compiler | |
parent | 50403afb5c8d49f2d9046498ea714251a3e4ad90 (diff) | |
download | Nim-f127bc387a8e45635a9e4aa9208df4c8e8c0f276.tar.gz |
Revert "Revert "test cases for the new features""
This reverts commit e1b668c868dbc647bb5da98d8e4769c2c9b351fd.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 4591c3942..3036a28e1 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -111,7 +111,11 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode = # var len = 0 # but won't be called # genericThatUsesLen(x) # marked as taking a closure? of skGenericParam: - if s.ast != nil: result = semExpr(c, s.ast) + if s.typ.kind == tyExpr: + result = newSymNode(s, n.info) + result.typ = s.typ.lastSon + elif s.ast != nil: + result = semExpr(c, s.ast) else: InternalError(n.info, "no default for") result = emptyNode @@ -888,10 +892,13 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = let tbody = ty.sons[0] for s in countup(0, tbody.len-2): let tParam = tbody.sons[s] - assert tParam.kind == tyGenericParam if tParam.sym.name == i: - let foundTyp = makeTypeDesc(c, ty.sons[s + 1]) - return newSymNode(copySym(tParam.sym).linkTo(foundTyp), n.info) + let rawTyp = ty.sons[s + 1] + if rawTyp.kind == tyExpr: + return rawTyp.n + else: + let foundTyp = makeTypeDesc(c, rawTyp) + return newSymNode(copySym(tParam.sym).linkTo(foundTyp), n.info) return else: # echo "TYPE FIELD ACCESS" |