diff options
-rw-r--r-- | src/libexpr/parser.y | 3 | ||||
-rw-r--r-- | tests/lang/eval-okay-regression-20220122.exp | 1 | ||||
-rw-r--r-- | tests/lang/eval-okay-regression-20220122.nix | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index a3e713937..55f8abcb7 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -404,7 +404,8 @@ expr_select expr_simple : ID { - if (strncmp($1.p, "__curPos", $1.l) == 0) + std::string_view s = "__curPos"; + if (strncmp($1.p, s.data(), s.size()) == 0) $$ = new ExprPos(CUR_POS); else $$ = new ExprVar(CUR_POS, data->symbols.create($1)); diff --git a/tests/lang/eval-okay-regression-20220122.exp b/tests/lang/eval-okay-regression-20220122.exp new file mode 100644 index 000000000..00750edc0 --- /dev/null +++ b/tests/lang/eval-okay-regression-20220122.exp @@ -0,0 +1 @@ +3 diff --git a/tests/lang/eval-okay-regression-20220122.nix b/tests/lang/eval-okay-regression-20220122.nix new file mode 100644 index 000000000..694e9a13b --- /dev/null +++ b/tests/lang/eval-okay-regression-20220122.nix @@ -0,0 +1 @@ +((_: _) 1) + ((__: __) 2) |