finos / rune-dsl

The project containing the Rune DSL grammar and default code generators
Apache License 2.0
27 stars 30 forks source link

Compilation issues when adding alias list from within an if statement #841

Open hugohills-regnosys opened 1 month ago

hugohills-regnosys commented 1 month ago

This compiles and runs successfully:

type Bar:
    foos Foo (0..*)

type Foo:
    attr string (1..1)

func FuncFoo:
    inputs:
        newFoos Foo (0..*)
        test boolean (1..1)
    output:
        bar Bar (1..1)

    add bar -> foos:
        if test
        then newFoos

But this works fails with compilation issues due to error: incompatible types: java.util.List<capture#1 of ? extends com.rosetta.test.model.Foo> cannot be converted to java.util.List<com.rosetta.test.model.Foo>

type Bar:
    foos Foo (0..*)

type Foo:
    attr string (1..1)

func FuncFoo:
    inputs:
        newFoos Foo (0..*)
        test boolean (1..1)
    output:
        bar Bar (1..1)

    alias filteredFoos: newFoos

    add bar -> foos:
        if test
        then filteredFoos
hugohills-regnosys commented 1 month ago

See PR for unit test (without a fix) https://github.com/finos/rune-dsl/pull/842