codeql icon indicating copy to clipboard operation
codeql copied to clipboard

Kotlin: Implement JvmOverloads annotation

Open smowton opened this issue 3 years ago • 2 comments

This generates functions that omit parameters with default values, rightmost first, such that Java can achieve a similar experience to Kotlin (which represents calls internally as if the default was supplied explicitly, and/or uses a $default method that supplies the needed arguments).

A complication: combining JvmOverloads with JvmStatic means that both the companion object and the surrounding class get overloads.

smowton avatar Jul 12 '22 18:07 smowton

@tamasvajk now that I've had to use a piece of background state to cope with type variable references, I've changed the strategy for handling value parameters to use the same mechanism instead of creating a proxy class that wraps IrValueParameter. I've also converted the remaining integration test into a unit test, and added a test for the case you pointed out where one parameter refers to another one.

smowton avatar Sep 26 '22 08:09 smowton

@tamasvajk I've adopted your suggestion to store the overridden attributes in the declaration stack

smowton avatar Sep 26 '22 16:09 smowton