Alexander Udalov
a7f4037206
Reflection: change order of arguments of inner generic type
...
As in KClassifier.createType and everywhere in the compiler, specify arguments
for the innermost type first. This is more convenient to use because generally
the construction/introspection of such type starts from the innermost class
anyway (i.e. something like generateSequence can be used, without the need to
call .reverse() in the end)
2016-08-08 17:54:11 +03:00
Alexander Udalov
89d69bc7eb
Reflection: add KClass.createInstance
2016-08-08 17:54:11 +03:00
Alexander Udalov
0525b1e6c1
Reflection: add KClass.declaredMembers
2016-08-08 17:54:11 +03:00
Alexander Udalov
30b7334e48
Reflection: add utilities to filter parameters by kind and name
2016-08-08 17:54:11 +03:00
Alexander Udalov
d78988a12a
Reflection: add KVisibility, KClass.visibility, KCallable.visibility
2016-08-08 17:54:11 +03:00
Alexander Udalov
7e317f7a7c
Reflection: add API for declaration modifiers
...
#KT-10447 Fixed
2016-08-08 17:54:11 +03:00
Alexander Udalov
ada81923dc
Reflection: add KClass.isInstance, KClass.cast, KClass.safeCast
...
#KT-11284 Fixed
2016-08-08 17:54:11 +03:00
Alexander Udalov
3702f4a7a7
Reflection: add KClass.{isSubclassOf,isSuperclassOf}, KType.{isSubtypeOf,isSupertypeOf}
...
The behavior in primitives.kt is likely to be reconsidered
#KT-8998 Fixed
2016-08-08 17:54:11 +03:00
Alexander Udalov
4cd252d9d5
Reflection: add KClass.{supertypes,superclasses,allSupertypes,allSuperclasses}
...
Some things are not implemented yet for allSupertypes, such as KType->Type
mapping of types and generic substitution of built-in types
2016-08-08 17:54:11 +03:00
Alexander Udalov
486ea62c72
Reflection: add KType.withNullability
2016-08-08 17:54:11 +03:00
Alexander Udalov
f958483e56
Reflection: deprecate KClass.defaultType
...
Its semantics were unclear and its javaType was implemented incorrectly (it
should have returned ParameterizedType with star projections for generic type)
2016-08-08 17:54:11 +03:00
Alexander Udalov
6b79782951
Reflection: add KClassifier.starProjectedType
...
#KT-8998 In Progress
2016-08-08 17:54:11 +03:00
Alexander Udalov
1edf3c7809
Reflection: add KClassifier.createType
...
#KT-8998 In Progress
2016-08-08 17:54:11 +03:00
Alexander Udalov
153e837a84
Reflection: add KType.jvmErasure
...
#KT-8998 In Progress
2016-08-08 17:54:11 +03:00
Alexander Udalov
e760b5ed53
Reflection: add KTypeParameter.toString
...
The test covers different type parameters with and without bounds, in case we
decide to also output upper bounds in toString
2016-08-08 17:54:11 +03:00
Alexander Udalov
170ea4dead
Reflection: add KVariance, KTypeParameter.{variance,upperBounds,equals,hashCode}
2016-08-08 17:54:11 +03:00
Alexander Udalov
127e7ab5b7
Reflection: add KClass.typeParameters, KCallable.typeParameters
...
Inheritance from KCallable is removed in kt9078.kt because it was irrelevant to
the test and because it gets in the way of modification of KCallable
2016-08-08 17:54:11 +03:00
Alexander Udalov
f69cc01f8e
Reflection: add KTypeProjection and KType.arguments
...
#KT-8998 In Progress
2016-08-08 17:54:11 +03:00
Alexander Udalov
c1dd831e65
Reflection: add KType.classifier
...
#KT-8998 In Progress
2016-08-08 17:54:11 +03:00
Alexey Andreev
19cea48637
JS: add tests to show that #KT-12865 fixed as well
2016-08-05 16:32:27 +03:00
Dmitry Petrov
a08e70879f
KT-13161 java static methods call not working for typealias
...
Introduce special qualifier for type aliases with member scope
containing static class members only.
2016-07-28 17:38:36 +03:00
Denis Zharkov
915e36cb02
Add Map.getOrDefault method as PlatformDependent declaration with refined signature
...
- First parameter should have type of K instead of Any
- Special bridge should return second parameter if a key has wrong type
- Special bridge may throw an exception if defaultValue has wrong type
#KT-13209 Fixed
2016-07-27 18:46:13 +03:00
Denis Zharkov
f2cb86c3f6
Minor. Fix testData
2016-07-27 18:46:13 +03:00
Dmitry Petrov
26c8bc87fd
KT-13241 Indices optimization leads to VerifyError with smart cast receiver
...
Use expected receiver type from the corresponding extension function.
2016-07-27 13:21:22 +03:00
Michael Bogdanov
9b9abb2e10
Fix for KT-13182: Regression: compiler internal error at inline
...
#KT-13182 Fixed
2016-07-26 16:16:37 +03:00
Michael Bogdanov
99cdc41ab6
Fix for KT-13133: Incorrect InnerClasses attribute value for anonymous object copied from an inline function
...
#KT-13133 Fixed
2016-07-26 16:16:36 +03:00
Alexander Udalov
91e486d020
Fix KCallable#name intrinsic for bound references
...
Do not skip generation of the left-hand side because it may produce side
effects
#KT-12995 Fixed
2016-07-26 13:48:20 +03:00
Alexander Udalov
0ea885ce58
Move tests on KClass.java* to box/classLiteral/java
...
Also replace WITH_REFLECT to WITH_RUNTIME to test that these cases correctly
work without reflection in the classpath
2016-07-26 13:48:19 +03:00
Alexander Udalov
70e01fac18
Fix class literals of objects in super constructor calls
...
In an expression such as "Obj::class" where Obj is an object, it's fine to
consider Obj either an expression or a type and generate either
Obj.INSTANCE.getClass() or Obj.class correspondingly. However,
the former fails in the object's super constructor call because the INSTANCE
field is not yet initialized. Thus, we force generation of Obj.class in case
when Obj is an object.
Note that this has been reproduced in our project, see
KotlinMetadataVersionIndex
2016-07-26 13:47:34 +03:00
Alexander Udalov
495ed13fce
Implement codegen for bound class reference expressions
...
- Inline the usage of ExpressionCodegen#generateClassLiteralReference into
ClosureCodegen, simplify
- Support DoubleColonLHS.Expression in generateClassLiteralReference
- Substantially simplify KClass.java intrinsic by reusing
generateClassLiteralReference
#KT-13075 Fixed
#KT-12995 In Progress
2016-07-26 13:47:33 +03:00
Denis Zharkov
becb1f1f95
Make stack values for assignment-like operations lazy
...
As well as for other kinds of expressions
Within attached test they were generated twice in case of last expression of coroutine block,
because coroutine related codegen part is built upon assumption that all expressions should be generated lazily
Also add a test about unary postfix increment/decrement
#KT-13156 Fixed
2016-07-25 13:56:43 +03:00
Alexander Udalov
0dd71cc0c0
Minor, add test on bound reference to enum entry member
2016-07-22 11:05:19 +03:00
Alexander Udalov
9ab8da2ef9
Fix type of reference to protected var
...
#KT-12982 Fixed
2016-07-22 11:05:19 +03:00
Michael Bogdanov
1d5924d236
'superConstructorCall' test folder moved under 'innerNested'
2016-07-21 19:10:42 +03:00
Michael Bogdanov
55382ba848
Removed obsolete code in 'lookupConstructorExpressionsInClosureIfPresent' method
2016-07-21 19:10:42 +03:00
Michael Bogdanov
5dca4dbc67
Fix for KT-11833: Error generating constructors of class null with kind IMPLEMENTATION on anonymous object inheriting from nested class of super class
...
#KT-11833 Fixed
2016-07-21 19:10:42 +03:00
Michael Bogdanov
6f41e3b462
Fix for KT-11634: UOE in ConstructorContext.getOuterExpression for super call in delegation
...
#KT-11634 Fixed
2016-07-20 16:50:49 +03:00
Denis Zharkov
3845ea863c
Do not generate DefaultImpl method for MutableMap.remove(K;V)Z
...
#KT-13069 Fixed
2016-07-12 16:27:48 +03:00
Denis Zharkov
18c2d3070d
Refine variables liveness analysis
...
Do not treat var as alive just because current instruction belongs to an item range
in local variables table, but the item has different sort of type
As liveness analysis is mostly used in coroutines spilling,
not applying this change may lead that to problems on Android (see tests)
2016-07-12 12:52:03 +03:00
Michael Bogdanov
23a0e19620
Fix for KT-13040: Invalid bytecode generated for extension lambda invocation with safe call
...
#KT-13040 Fixed
2016-07-09 14:55:49 +03:00
Michael Bogdanov
486aa5675f
Fix for KT-12908: Variable initialization in loop causes VerifyError bad local variable type
...
#KT-12908 Fixed
2016-07-09 07:45:57 +03:00
Dmitry Petrov
b0edec8449
KT-13023 Char operations throw ClassCastException for boxed Chars
...
Char is not a Number, so we can't use the same coercion strategy for Char members,
since it doesn't work for boxed Chars.
2016-07-08 10:26:04 +03:00
Denis Zharkov
3a59e1d222
Support suspending extension functions
2016-07-06 15:25:19 +03:00
Dmitry Petrov
3445fe0d30
KT-12985 Do not create range instances for 'for' loop in CharSequence.indices
2016-07-06 12:50:41 +03:00
Dmitry Petrov
3dc23a0e02
KT-12983 java.lang.VerifyError: Bad type on operand stack in arraylength
...
Use proper receiver value type.
2016-07-06 09:59:00 +03:00
Michael Bogdanov
6b8e8cee17
Fix for KT-12891: Allow to omit type in local delegated property declaration
...
#KT-12891 Fixed
2016-07-05 21:22:48 +03:00
Alexander Udalov
3b349e9be0
Fix reflection on reference to generic property
...
See a93484b457 for the similar fix to function
references
#KT-12967 Fixed
2016-07-05 18:18:43 +03:00
Denis Zharkov
a420fda825
Fix problem with missing handleResult call
...
At first we try to resolve 'handleResult' just as last expression
in a lambda is first argument, then if results are unsuccessful
try resolve 'handleResult' with fake Unit expression
#KT-12969 Fixed
2016-07-05 15:36:06 +03:00
Denis Zharkov
888db4b3b5
Make 'controller' field package-private
...
To make it accessible from nested lambdas
#KT-12974 Fixed
2016-07-05 15:36:06 +03:00
Denis Zharkov
d657bc8110
Treat any coroutine as it has non-const closure
...
Because it's always does capture controller
2016-07-05 15:36:06 +03:00