failing test case preventing the use of --gc:v2: tsymchoicefield
This commit is contained in:
parent
d310b01db1
commit
e8c50640d7
3 changed files with 22 additions and 7 deletions
|
|
@ -48,17 +48,17 @@ type
|
||||||
nnkYieldStmt, nnkTryStmt, nnkFinally, nnkRaiseStmt,
|
nnkYieldStmt, nnkTryStmt, nnkFinally, nnkRaiseStmt,
|
||||||
nnkReturnStmt, nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, nnkStaticStmt,
|
nnkReturnStmt, nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, nnkStaticStmt,
|
||||||
nnkDiscardStmt, nnkStmtList,
|
nnkDiscardStmt, nnkStmtList,
|
||||||
|
|
||||||
nnkImportStmt,
|
nnkImportStmt,
|
||||||
nnkImportExceptStmt,
|
nnkImportExceptStmt,
|
||||||
nnkExportStmt,
|
nnkExportStmt,
|
||||||
nnkExportExceptStmt,
|
nnkExportExceptStmt,
|
||||||
nnkFromStmt,
|
nnkFromStmt,
|
||||||
nnkIncludeStmt,
|
nnkIncludeStmt,
|
||||||
|
|
||||||
nnkBindStmt, nnkMixinStmt, nnkUsingStmt,
|
nnkBindStmt, nnkMixinStmt, nnkUsingStmt,
|
||||||
nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr,
|
nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr,
|
||||||
nnkStmtListType, nnkBlockType, nnkTypeOfExpr, nnkObjectTy,
|
nnkStmtListType, nnkBlockType,
|
||||||
|
nnkWith, nnkWithout,
|
||||||
|
nnkTypeOfExpr, nnkObjectTy,
|
||||||
nnkTupleTy, nnkTypeClassTy, nnkStaticTy,
|
nnkTupleTy, nnkTypeClassTy, nnkStaticTy,
|
||||||
nnkRecList, nnkRecCase, nnkRecWhen,
|
nnkRecList, nnkRecCase, nnkRecWhen,
|
||||||
nnkRefTy, nnkPtrTy, nnkVarTy,
|
nnkRefTy, nnkPtrTy, nnkVarTy,
|
||||||
|
|
|
||||||
12
tests/template/tsymchoicefield.nim
Normal file
12
tests/template/tsymchoicefield.nim
Normal 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
|
||||||
|
|
||||||
|
|
@ -13,6 +13,8 @@ discard """
|
||||||
3
|
3
|
||||||
aa
|
aa
|
||||||
bb
|
bb
|
||||||
|
11
|
||||||
|
22
|
||||||
aa
|
aa
|
||||||
bb
|
bb
|
||||||
24'''
|
24'''
|
||||||
|
|
@ -45,9 +47,11 @@ type
|
||||||
const data: TData = (@["aa", "bb"], @[11, 22])
|
const data: TData = (@["aa", "bb"], @[11, 22])
|
||||||
|
|
||||||
static:
|
static:
|
||||||
var m = data
|
var m1 = data
|
||||||
for x in m.letters:
|
for x in m1.letters: echo x
|
||||||
echo x
|
|
||||||
|
var m2: TData = data
|
||||||
|
for x in m2.numbers: echo x
|
||||||
|
|
||||||
macro ff(d: static[TData]): stmt =
|
macro ff(d: static[TData]): stmt =
|
||||||
for x in d.letters:
|
for x in d.letters:
|
||||||
|
|
@ -55,7 +59,6 @@ macro ff(d: static[TData]): stmt =
|
||||||
|
|
||||||
ff(data)
|
ff(data)
|
||||||
|
|
||||||
|
|
||||||
# bug #1010
|
# bug #1010
|
||||||
|
|
||||||
proc `*==`(x: var int, y: int) {.inline, noSideEffect.} =
|
proc `*==`(x: var int, y: int) {.inline, noSideEffect.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue