This syntax is reserved to be likely used in the future as a shorthand for
"this::foo" where the resulting expression doesn't take the receiver as a
parameter but has "this" already bound to it
Resolve callable references taking into account expected callable types.
This affects call resolution procedure (resolve 'foo' in for 'foo(::bar)') similar to the approach used for function literals:
* During "shape arguments" phase of call resolution, callable references are resolved in independent context without expected type. If the callable reference is ambiguous, its shape type is a function placeholder type without parameter types and return type information. Otherwise, it is a reflection type for the resolved function or property. Upper-level call is resolved without taking into account ambiguous callable references.
* During "complete call" phase of call resolution, resolve callable reference arguments to actual descriptors (if possible), and update constraint system for the given call accordingly.
#KT-6982 Fixed
#KT-5780 Fixed
Each property reference obtained by the '::' operator now causes back-end to
generate an anonymous subclass of the corresponding KProperty class, with the
customized behavior. This fixes a number of issues:
- get/set/name of property references now works without kotlin-reflect.jar in
the classpath
- get/set/name methods are now overridden with statically-generated property
access instead of the default KPropertyImpl's behavior of using Java
reflection, which should be a lot faster
- references to private/protected properties now work without the need to set
'accessible' flag, because corresponding synthetic accessors are generated at
compile-time near the target property
#KT-6870 Fixed
#KT-6873 Fixed
#KT-7033 Fixed
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
- use ConcurrentHashMap as a cache of class loaders to module descriptors
- KClassImpl now has a lazy class descriptor and it manages property creation
by looking (also lazily) for the property descriptor in the corresponding
scope
- since deserialized descriptors have full information about where a JVM symbol
is located and what signature it has, new tests will begin to pass where
Kotlin model and Java reflection model differ, see classObjectVar.kt
The former name clashes with java.lang.IllegalAccessException and proved to be
inconvenient because it should always be qualified in the source.
Also use java.lang exception's message as kotlin.reflect exception's message
#KT-5402 Fixed
#KT-4838 Fixed
Resolve type of object inside local object as special, not supertype('Any').
Changed visibility of constructor of anonymous object to 'internal' to be able to resolve the following:
fun box(): String {
var foo = object {
val bar = object {
val baz = "ok"
}
}
return foo.bar.baz
}
The containing declaration of property initializers is constructor, so 'baz' was invisible inside private constructor.
Move from package "kotlin.reflect" to "kotlin.reflect.jvm.internal". They are
internal detail of the compiler and should not be used directly (especially now
that "kotlin.reflect" is in default import paths).
Also rename "KFunctionImplN" to "KFunctionNImpl", because this name makes more
sense
Metadata for KFunction classes is now longer serialized along with built-in
classes. This effectively means that it's no longer possible to find KFunction
classes via dependency on built-ins. There should be a kotlin-runtime library
in the specified classpath for reflection types to be resolvable.
A lot of tests were moved and changed, because tests on callable references
require stdlib in classpath from now on