Skip to content

Invalid Java generation for function eval with unused result #622

@kevin-m-knight-gs

Description

@kevin-m-knight-gs

Bug Report

Steps to Reproduce:

The following code compiles in Pure, but yields a Java compilation error in compiled mode.

import test::*;

function test::inspect<T|m>(values:T[m], fn:Function<{T[m]->Any[*]}>[1]):T[m]
{
    $fn->eval($values);
    $values;
}

function test::test():Any[*]
{
    inspect([1, 2, 3, 4], v | $v->map(i | $i->toString())->joinStrings('[', ', ', ']\\n'))
}

An ignored failing test was added for this in this commit.

Expected Result:

The Java code that is generated for the Pure code should compile (and behave correctly).

Actual Result:

What actually happens is a Java compilation error which complains that the generated Java code is not a statement.

Environment:

This was reproduced with legend-pure 3.7.0 and JDK 11.0.16.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions