From 5544a6671e442b0d35b624ace0959f6324c5402a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 14 Oct 2023 18:52:10 +0100 Subject: [PATCH] interp: add TODOs about test operator precedence Spotted this parser issue when investigating #1036. Note that parsing of [[ happens in the syntax parser, but the classic [ test is done in the interpreter. Both treat both binary operators as having the same precedence. --- interp/interp_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interp/interp_test.go b/interp/interp_test.go index 335656b5..e6fb2000 100644 --- a/interp/interp_test.go +++ b/interp/interp_test.go @@ -1609,6 +1609,8 @@ var runTests = []runTest{ {"set -n; [[ -o noexec ]]", ""}, // actually does nothing, but oh well {"[[ -o pipefail ]]", "exit status 1"}, {"set -o pipefail; [[ -o pipefail ]]", ""}, + // TODO: we don't implement precedence of && over ||. + // {"[[ a == x && b == x || c == c ]]", ""}, // classic test { @@ -1706,6 +1708,8 @@ var runTests = []runTest{ {"[ a != a ]", "exit status 1"}, {"[ abc = ab* ]", "exit status 1"}, {"[ abc != ab* ]", ""}, + // TODO: we don't implement precedence of -a over -o. + // {"[ a = x -a b = x -o c = c ]", ""}, // arithm {