Add nkFastAsgn into semExpr (#20939)

* Add nkFastAsgn into case statement

* Add test case
This commit is contained in:
Jake Leahy
2022-11-28 06:09:25 +11:00
committed by GitHub
parent 5a848a0707
commit d26b1232ee
2 changed files with 13 additions and 1 deletions

View File

@@ -3116,7 +3116,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}, expectedType: PType
# the node is left intact for now
discard
of nkStaticExpr: result = semStaticExpr(c, n[0], expectedType)
of nkAsgn: result = semAsgn(c, n)
of nkAsgn, nkFastAsgn: result = semAsgn(c, n)
of nkBlockStmt, nkBlockExpr: result = semBlock(c, n, flags, expectedType)
of nkStmtList, nkStmtListExpr: result = semStmtList(c, n, flags, expectedType)
of nkRaiseStmt: result = semRaise(c, n)

12
tests/magics/t20938.nim Normal file
View File

@@ -0,0 +1,12 @@
discard """
cmd: "nim c --mm:refc $file"
action: "compile"
"""
template foo(x: typed) =
discard x
foo:
var x = "hello"
x.shallowCopy("test")
true