Commit Graph

3 Commits

Author SHA1 Message Date
Georgy Bronnikov
0d8036bb14 JVM_IR: do not generate main() when extension main is present
Extension methods with signature C.main() should not cause generation
of main(args: Array<String>).
2019-12-18 15:25:57 +03:00
Kristoffer Andersen
4973baae4e [JVM IR] Fix JvmOverloads+Parameterless Main
Resolves the interaction of @JvmOverloads annotations and
parameterless main methods.

In the following code, both mechanisms generate methods that
ultimately produce the signature `public static void main(String[] args)`
of which there can be only one (true in general of any signature).

```
fun main() { }

@JvmOverloads
fun main(Array<String> args, x: Int = 42) { }
```

This PR simply shuffles the lowerings around, letting parameterless
main methods detect the presence of the default overload produced by
the annotation.

Additionally, this PR improves the testing of parameterless main
methods by actual bytecode patterns, and not simple check for
successful compilation (as @sfs and I discovered, there are issues in
flagging an error on duplicate signatures on the IR backend).
2019-11-13 13:03:14 +01:00
Kristoffer Andersen
28b6913a25 JVM IR: Support parameterless main methods
This commit:

- introduces tests explicating what is and isn't considered a
  proper main method on the JVM backends.
- implements support for parameterless main methods on the JVM IR
  backend
- See KT-34338 for more tests.
2019-10-21 15:08:34 +02:00