jolie / jolie

The Jolie programming language
https://www.jolie-lang.org/
GNU Lesser General Public License v2.1
539 stars 54 forks source link

ProgramInspector finds type with a name prefixed with <NUM># #309

Open klag opened 3 years ago

klag commented 3 years ago

When executing joliedoc against this service, the resulting outputport contains types with a name prefixed with #

from file import File

service test {
    embed File as File

    main {
        nullProcess
    }
}

The result is: image

A test has been added for reproducing the bug here https://github.com/jolie/jolie/tree/bug_inspector

The test just uses metajolie for checking the name of the types produced by jolie.lang.parse.util.ProgramInspector;

fmontesi commented 3 years ago

@kicito Could you have a look at this?

kicito commented 3 years ago

Sure! let me try :)

kicito commented 3 years ago

Hi, it seems like the prefix is only added to fault type in OLParser. To prevent the infinite loop on linking types phase, I believe.

https://github.com/jolie/jolie/blob/8ce438aaf986cde9e6770678e7db80bfac149863/libjolie/src/main/java/jolie/lang/parse/OLParser.java#L1987-L1989

A (perhaps) simple solution is we can modify the return content of type.id() and type.name() which are currently identical. One for the machine-related operations and the other for readability.

fmontesi commented 3 years ago

Having a method that returns the "simple" name of a type sounds sensible to me. Not sure if we should use id for that. Can you do a quick check to see where id is used? It's not a method that implements an interface, so we could easily rename it to "simpleName", for example.

kicito commented 3 years ago

Sure, just did a check and I think it should be an easy fix.

mwallnoefer commented 5 months ago

@kicito any news on this one?