From a8ff4ac26e6be7ca6a7039d1d963b86aaad070bb Mon Sep 17 00:00:00 2001 From: Springcomp Date: Wed, 21 Jun 2023 22:01:24 +0200 Subject: [PATCH] Fixes #69 - evaluate rhs after string slices --- compliance | 2 +- pkg/interpreter/interpreter.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compliance b/compliance index ffa8a5a..304b287 160000 --- a/compliance +++ b/compliance @@ -1 +1 @@ -Subproject commit ffa8a5ac6eb73c4297ff7d997ac5786ee4309d59 +Subproject commit 304b287a9537673227c2e300a34ff8e4757579c5 diff --git a/pkg/interpreter/interpreter.go b/pkg/interpreter/interpreter.go index 7d5dc95..f8d7277 100644 --- a/pkg/interpreter/interpreter.go +++ b/pkg/interpreter/interpreter.go @@ -371,7 +371,13 @@ func (intr *treeInterpreter) Execute(node parsing.ASTNode, value interface{}) (i } stringType, ok := left.(string) if allowString && ok { - return stringType, nil + // a projection is really a sub-expression in disguise + // we must evaluate the right hand expression + result, err := intr.Execute(node.Children[1], stringType) + if err != nil { + return nil, err + } + return result, nil } return nil, nil }