Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KCL parser should allow if expr after |> #4335

Open
adamchalmers opened this issue Oct 28, 2024 · 0 comments
Open

KCL parser should allow if expr after |> #4335

adamchalmers opened this issue Oct 28, 2024 · 0 comments
Labels
ast Issues / features relevant to ast and parser. kcl Language and compiler features

Comments

@adamchalmers
Copy link
Collaborator

adamchalmers commented Oct 28, 2024

This KCL program parses:

fn f = (i) =>  { return i + 1}

0 |> f(%)

This equivalent program doesn't:

fn f = (i) =>  { return i + 1}

- 0 |> f(%)
+ 0 |> if true {
+   f(%)
+ } else {
+   f(%)
+ }

Because the parser defines a pipeline expression as some expression followed by 1 or more CallExpression, and in the second example, it's followed by an IfExpression. Clearly the pipeline expression parser should allow this too.

Thanks @lf94 for leading me to this.

@adamchalmers adamchalmers added ast Issues / features relevant to ast and parser. kcl Language and compiler features labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Issues / features relevant to ast and parser. kcl Language and compiler features
Projects
None yet
Development

No branches or pull requests

1 participant