failing test case preventing the use of --gc:v2: tsymchoicefield

This commit is contained in:
Zahary Karadjov 2014-03-24 12:17:22 +02:00
commit e8c50640d7
3 changed files with 22 additions and 7 deletions

View file

@ -48,17 +48,17 @@ type
nnkYieldStmt, nnkTryStmt, nnkFinally, nnkRaiseStmt,
nnkReturnStmt, nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, nnkStaticStmt,
nnkDiscardStmt, nnkStmtList,
nnkImportStmt,
nnkImportExceptStmt,
nnkExportStmt,
nnkExportExceptStmt,
nnkFromStmt,
nnkIncludeStmt,
nnkBindStmt, nnkMixinStmt, nnkUsingStmt,
nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr,
nnkStmtListType, nnkBlockType, nnkTypeOfExpr, nnkObjectTy,
nnkStmtListType, nnkBlockType,
nnkWith, nnkWithout,
nnkTypeOfExpr, nnkObjectTy,
nnkTupleTy, nnkTypeClassTy, nnkStaticTy,
nnkRecList, nnkRecCase, nnkRecWhen,
nnkRefTy, nnkPtrTy, nnkVarTy,

View file

@ -0,0 +1,12 @@
type Foo = object
len: int
var f = Foo(len: 40)
template getLen(f: Foo): expr = f.len
echo f.getLen
# This fails, because `len` gets the nkOpenSymChoice
# treatment inside the template early pass and then
# it can't be recognized as a field anymore

View file

@ -13,6 +13,8 @@ discard """
3
aa
bb
11
22
aa
bb
24'''
@ -45,9 +47,11 @@ type
const data: TData = (@["aa", "bb"], @[11, 22])
static:
var m = data
for x in m.letters:
echo x
var m1 = data
for x in m1.letters: echo x
var m2: TData = data
for x in m2.numbers: echo x
macro ff(d: static[TData]): stmt =
for x in d.letters:
@ -55,7 +59,6 @@ macro ff(d: static[TData]): stmt =
ff(data)
# bug #1010
proc `*==`(x: var int, y: int) {.inline, noSideEffect.} =