Skip to content

[arithmetics example] incorrect evaluation when number is used as a function #2167

Description

@sorawee

Langium version: the one that runs on https://langium.org/showcase/arithmetics/
Package name: the one that runs on https://langium.org/showcase/arithmetics/

Steps To Reproduce

Run the code provided below in https://langium.org/showcase/arithmetics/

Link to code example:

Module basicMath

def sqrt(x):
    x(2);

Sqrt(81);

The current behavior

Passes validation, and evaluates to 81.

The expected behavior

This should really fail validation because the language's grammar doesn't permit higher-order function, so any parameter used at the function position is definitely incorrect. But it doesn't fail the validation. In fact, the grammar explicitly permits it for an unknown reason.

On evaluation, it also simply returns the parameter, discarding 2, which also seems wrong

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    examplesIssue about one of the included example packages

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions