Skip to content

KCL parser should allow if expr after |> #4335

@adamchalmers

Description

@adamchalmers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/astkclLanguage and compiler features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions