ceylon

Top level function names restricted?


Normally Ceylon loves when a file name corresponds with the name of the (only) class that gets declared in that file.

When I try to follow the same pattern with a top level function, the IDE barks at me. Example:

File structure:

The content of the file stringFromFile.ceylon:

String|Null stringFromFile() {
    return null
}

The error message produced by the IDE is: "duplicate declaration. The name stringFromFile is not unique in this scope". This message occurs when the cursor hovers over the function name declaration of 'stringFromFile'.

This declaration of stringFromFile is the only one in the code base (as revealed by a global search). The only "overlapping" name is the name of the containing file. Why are these two names not allowed to overlap?


Solution

  • Restarting the IntelliJ IDE will solve the problem.