The class itself can't be deleted at this point because it's used in the old
bytecode and tools (e.g. proguard) will complain if they can't find it in the
new runtime
1. ConstantValue
* just holds some value and its type
* implementations for concrete constants
2. CompileTimeConstant
* is only produced by ConstantExpressionEvaluator
* has additional flags (canBeUsedInAnnotation etc)
* has two implementations TypedCompileTimeConstant containing a constant value
and IntegerValueConstant which does not have exact type
* can be converted to ConstantValue
Adjustt usages to use ConstantValue if flags are not needed
Add tests for some uncovered cases
Get rid of all classes except kotlin.reflect.KFunction, which will be used to
represent all kinds of simple functions.
Lots of changes to test data are related to the fact that KFunction is not an
extension function (as opposed to KMemberFunction and KExtensionFunction who
were) and so a member or an extension function reference now requires all
arguments be passed to it in the parentheses, including receivers. This is
probably temporary until we support calling any function both as a free
function and as an extension. In JS, functions and extension functions are not
interchangeable, so tests on this behavior are removed until this is supported
It's parameter is FQ-name of class (currently only from builtins) that added as supertype to annotated Java class.
Parameters of annotated class used as non-flexible arguments of added supertype, that helps to propagate more precise types when using in Kotlin.
Some standard JDK collections loaded as they annotated with PurelyImplements.
See tests for clarification.
Before: ArrayList<Int>.add(x: Int!) // possible to add null
After: ArrayList<Int>.add(x: Int) // impossible to add null
#KT-7628 Fixed
#KT-7835 Fixed
Before this commit old type parameters were inserted into new descriptor,
and that broke a simple contract: desc.child.getContainingDeclaration() == desc.
We use `doSubstitute` here because it does exactly what we need:
1. creates full copy of descriptor
2. copies method's type parameters (with new containing declaration) and properly substitute to them in value parameters, return type and etc.
But we had to customize `doSubstitute`: add some parameters like `newReturnType`
NOTE: Strange testData change.
(Mutable)List<in T!>! after substitution becomes MutableList<in T!>..List<*>?.
But it's not wrong because List<in T> behaves exactly as List<*>, and the same happens when substituing Java class scope:
public class A<E> {
<T> void foo(List<? super T> x) {}
}
Kotlin:
A.foo(), type of first value parameter --- (Mutable)List<in T!>
A<String>().foo(), type of first value parameter --- MutableList<in T!>..List<*>?
It's needed because new parameter owner is not created while enhacing types
(It was containing declaration of old value parameter that is wrong)
Also simplified SignatureParts' logic: `replaceType` is always an identity function