Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [golo-dev] Importing unions

You're welcome Vincent,

did you try to import 'test2.types.Union2' ?

http://golo-lang.org/documentation/next/#_jvm_existence_2

regards,
Sylvain.

Le mar. 6 mars 2018 à 20:27, Vincent <vvanderleun@xxxxxxxxxxxx> a écrit :
Hello,

Hope I am not asking a dumb question *AGAIN*...

I have a test file "test1.golo":

======

module test1

import test2

struct Struct1 = {
        TEST1,
        TEST2
}

union Union1 = {
        value1
        value2
}

function main = |args| {
        let s1 = Struct1()
        let s2 = Struct2()
        let u1 = Union1.value1()
        let u2 = Union2.EMPTY()
        println(u2)
}

======

And a file "test2.golo":

======

module test2

struct Struct2 = {
        TEST3,
        TEST4
}

union Union2 = {
    EMPTY
    NOT_EMPTY
}

function main = |args| {
        let s2 = Struct2()
        let u2 = Union2.EMPTY()
        println(s2)
        println(u2)
}

======

When I run test1.golo with "golo shebang test1.golo", I get the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: Union2.EMPTY()Ljava/lang/Object;
        at org.eclipse.golo.runtime.FunctionCallSupport.fallback(FunctionCallSupport.java:149)
        at test1.main(test1.golo:19)
        at org.eclipse.golo.cli.command.spi.CliCommand.callRun(CliCommand.java:39)
        at org.eclipse.golo.cli.command.ShebangCommand.execute(ShebangCommand.java:45)
        at org.eclipse.golo.cli.Main.main(Main.java:69)

I may be missing completely obvious, but why can't the Union2.EMPTY() be resolved, when running test1.golo, while resolving Struct2 is no problem? I have tried prefixing it with test2, or "import test2.Union2" but that did not work either.

Thanks for your time :)

Kind regards,
Vincent
_______________________________________________
golo-dev mailing list
golo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/golo-dev

Back to the top