diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-12-27 02:16:53 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-27 09:16:53 +0100 |
commit | 1d615dfda7102c5d7f190b077c0ae87abac34228 (patch) | |
tree | 5f1870685189e77d9c36b85c910af01fd78ca06f /lib | |
parent | 1e859fa320e6f6a0fa3773c1ecf37707dd656b6c (diff) | |
download | Nim-1d615dfda7102c5d7f190b077c0ae87abac34228.tar.gz |
fix #16474 `unittest.check type1 is type2` gives CT error (#16476)
* fix #16474 * more tests
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/unittest.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index ab45f78dc..18b09e4c0 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -669,7 +669,8 @@ macro check*(conditions: untyped): untyped = let paramAst = exp[i] if exp[i].kind == nnkIdent: result.printOuts.add getAst(print(argStr, paramAst)) - if exp[i].kind in nnkCallKinds + {nnkDotExpr, nnkBracketExpr, nnkPar}: + if exp[i].kind in nnkCallKinds + {nnkDotExpr, nnkBracketExpr, nnkPar} and + (exp[i].typeKind notin {ntyTypeDesc} or $exp[0] notin ["is", "isnot"]): let callVar = newIdentNode(":c" & $counter) result.assigns.add getAst(asgn(callVar, paramAst)) result.check[i] = callVar |