diff --git a/pkg/vm/compiler/codegen.go b/pkg/vm/compiler/codegen.go index 080f72368..471ef70af 100644 --- a/pkg/vm/compiler/codegen.go +++ b/pkg/vm/compiler/codegen.go @@ -392,11 +392,19 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor { } case n.Op == token.EQL: // VM has separate opcodes for number and string equality - if isStringType(tinfo.Type) { + if isStringType(c.typeInfo.Types[n.X].Type) { emitOpcode(c.prog, vm.EQUAL) } else { emitOpcode(c.prog, vm.NUMEQUAL) } + case n.Op == token.NEQ: + // VM has separate opcodes for number and string equality + if isStringType(c.typeInfo.Types[n.X].Type) { + emitOpcode(c.prog, vm.EQUAL) + emitOpcode(c.prog, vm.NOT) + } else { + emitOpcode(c.prog, vm.NUMNOTEQUAL) + } default: c.convertToken(n.Op) }