From 898a4bc4fa01bb124edeb837285cd7155f13b6c1 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Fri, 29 Jun 2018 16:34:47 +0200 Subject: [PATCH] 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`. --- compiler/semexprs.nim | 2 ++ 1 file changed, 2 insertions(+) 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: