From 44e575cc057be17da5ba7c983e9d562fcb57facc Mon Sep 17 00:00:00 2001 From: "Amy J. Ko" Date: Sat, 2 Mar 2024 14:55:23 -0800 Subject: [PATCH] Narrowed parsing of structure refinements to avoid conflicting with spreads in lists. --- CHANGELOG.md | 1 + src/parser/parseExpression.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f0f0ef8..5d318b32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http: - Disabled automatic pretty printing. - Fixed list spread doc example. - Better unused bind conflict message. +- Narrowed parsing of structure refinements to avoid conflicting with spreads in lists. ## 0.9.34 2024-02-24 diff --git a/src/parser/parseExpression.ts b/src/parser/parseExpression.ts index 8041a78ea..99e8c8afa 100644 --- a/src/parser/parseExpression.ts +++ b/src/parser/parseExpression.ts @@ -860,7 +860,11 @@ function parsePropertyReference(left: Expression, tokens: Tokens): Expression { ); // If there's a bind symbol next, then parse a PropertyBind - if (left instanceof PropertyReference && tokens.nextIs(Sym.Bind)) { + if ( + left instanceof PropertyReference && + tokens.nextIs(Sym.Bind) && + tokens.nextLacksPrecedingSpace() + ) { const bind = tokens.read(Sym.Bind); const value = parseExpression(tokens);