diff options
author | Vindaar <basti90@gmail.com> | 2018-06-29 16:34:47 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-06-29 16:34:47 +0200 |
commit | 898a4bc4fa01bb124edeb837285cd7155f13b6c1 (patch) | |
tree | 1114c89667ae7c04ffeea7e285239274373c6eb3 /compiler | |
parent | ae69e571e1c9c2ce5e29b938ad9c376c74b3cd5b (diff) | |
download | Nim-898a4bc4fa01bb124edeb837285cd7155f13b6c1.tar.gz |
fix #8129 by calling `semExpr` in `semIs` if node is `strLit` (#8130)
* call `semExpr` in `semIs` if node is `strLit`, fixes #8129 In case the second son of the node in `semIs` is of kind `strLit`, we now call `semExpr` to set the `typ` field of that node. Also removes the `t2 != tyTypeDesc` check in `isOpImpl`, since the kind of `n[2]` is already assertet with the `internalAssert`. * reintroduce check for `t2.kind != tyTypeDesc` to fix test case The `internalAssert` in the `isOpImpl` doesn't check `n.sons[2].typ.kind` as I previously read, but rather `n.sons[2].kind`. Therefore the check for `tyTypeDesc` here is useful. Otherwise the last test case in `isopr.nim` fails. Also removes the flag `efDetermineType` from the call to `semExpr`.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 5d6eaf652..031174e5d 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -393,6 +393,8 @@ proc semIs(c: PContext, n: PNode, flags: TExprFlags): PNode = # When the right-hand side is an explicit type, we must # not allow regular values to be matched against the type: liftLhs = false + else: + n.sons[2] = semExpr(c, n[2]) var lhsType = n[1].typ if lhsType.kind != tyTypeDesc: |