Commit Graph

1504 Commits

Author SHA1 Message Date
Alexander Udalov 6e97f85863 Fix type argument substitution bug in KFunction construction
For example,

KMemberFunction2<T, P1, P2, R> : KMemberFunction<T, R>

So for this inheritance the heuristic that was present ("take the last K type
parameters of the subclass, and substitute for K parameters of the superclass")
was wrong. The new heuristic for this case is: take type parameters with the
same names.

Also don't store "parameters" in a lazy value, since it's easy to compute and
it's computed practically every time anyway
2015-06-04 23:08:21 +03:00
Alexander Udalov b474fa9278 Refactor fictitious function class kinds, reuse in J<->K map 2015-06-04 23:08:21 +03:00
Denis Zharkov 0e718fbaab Introduce UNKNOWN visibility as default in FunctionDescriptor
It's needed to prevent NPE when requesting non-nullable visibility of descriptor
before `initialize` has been called.
Currently it happens because of indirect calls of `DescriptorUtils.isLocal`
between descriptor creation and it's initialization.
2015-06-04 16:11:02 +03:00
Denis Zharkov 4f85afb3f0 Fix DescriptorUtils.isLocal semantics
Non-member descriptors, e.g. type parameters, value parameters that defined in local function should be local too
Otherwise a lot of exceptions happens when resolving references within anonymous objects
2015-06-04 16:11:02 +03:00
Alexander Udalov e38bc864d1 Fix heavy integer parsing in FunctionN class factory
#KT-7924 Fixed
2015-06-03 15:37:49 +03:00
Alexander Udalov 6c8f2be1d8 Revert "Fix heavy integer parsing in FunctionN class factory"
This reverts commit 9d493d995e.
2015-06-03 15:32:47 +03:00
Alexander Udalov 9d493d995e Fix heavy integer parsing in FunctionN class factory
#KT-7924 Fixed
2015-06-03 15:14:23 +03:00
Dmitry Jemerov 758b94d3a6 get rid of JetScopeSelectorUtil, inline its contents into Kotlin code 2015-06-03 12:03:15 +02:00
Dmitry Jemerov 9672264442 avoid unnecessary and expensive creation of FqName instances 2015-06-02 16:36:03 +02:00
Alexander Udalov d1df234cfe Support annotations as annotation arguments in reflection, add test
A follow-up to 281acb8 where this was supported in the compiler
2015-06-02 17:31:19 +03:00
Alexander Udalov 158b3ba102 Make parameter names of fictitious function classes non-stable
To be able to change them when overriding invoke in subclasses without a
warning
2015-06-02 17:30:58 +03:00
Alexander Udalov 16b20cf910 Fix NoSuchMethodError on FunctionReference#init 2015-06-02 17:29:52 +03:00
Denis Zharkov 70dbbd8fda Resolve constructors declared in traits and objects
It prevents exceptions and produces less red code

 #EA-68667 Fixed
2015-06-02 14:07:49 +03:00
Dmitry Jemerov 22168aa026 optimize DescriptorUtils.getContainingModuleOrNull() by removing duplicate parent traversal and Class.isInstance() checks 2015-06-02 11:55:16 +02:00
Alexander Udalov 596d378962 Fix abstract method error: implement arity in function references 2015-06-01 19:23:09 +03:00
Valentin Kipyatkov d74ac4d08a Override/implement members dialog: no qualified type names in signatures but qualified owner class names (+ moved a method) 2015-06-01 18:23:34 +03:00
Dmitry Jemerov e0f819d93c document ReplaceWith annotation 2015-05-29 17:11:22 +02:00
Alexander Udalov dff3e17d88 Minor, swap order of parameters for clarity 2015-05-28 22:09:24 +03:00
Alexander Udalov d14e5b8a72 Restore and deprecate Function{n}/ExtensionFunction{n} classes for easier migration
Users' Java code will not break in common cases (when passing functions to
Kotlin), and deprecation warnings will be reported.

Provide an inspection with a quick fix which allows to replace deprecated
function class usages to the new classes. Include this fix to the "code
cleanup" action
2015-05-28 01:20:05 +03:00
Valentin Kipyatkov 281acb860e Loading of annotation class arguments from compiled classes 2015-05-27 16:15:50 +03:00
Valentin Kipyatkov a6f76bbf76 Fixed keywords after 'this@' completion + fixed implementation of JetExpressionWithLabel.getLabelName() 2015-05-27 16:15:46 +03:00
Valentin Kipyatkov df850d7035 DeprecatedSymbolUsageFix: initial implementation 2015-05-27 16:15:45 +03:00
Ilya Gorbunov 84ca26719d Deprecate meaningless or vague-defined operations with Char operands.
Change expected test output.
2015-05-27 00:58:35 +03:00
Ilya Gorbunov c6abf75856 Do not generate primitive type definition for Char, place it in a file beside. 2015-05-27 00:58:24 +03:00
Alexander Udalov 48b18f18d3 Restore explicit imports of Kotlin function types in Java
This is a follow-up to 738a84e259 and
d4965a4f3e. Optimize imports in all files
affected in those commits, drop temporary _.kt
2015-05-26 18:46:27 +03:00
Svetlana Isakova 14c2690447 Distinguish between no declared arguments and an empty argument list
in a function literal
If there are no arguments, any number of them might be expected
2015-05-26 15:05:03 +03:00
Svetlana Isakova d9568ef88c Added special type constructor for function/ extension function
that stores an information about declared argument types
2015-05-26 15:05:02 +03:00
Alexander Udalov 9ba6d91e2e Prepare JVM runtime for support of reflection on functions
Introduce abstract class FunctionReference, which is supposed to be a
superclass for all anonymous classes generated for function references. Each
anonymous subclass will have statically-generated symbol info, which will be
used by reflection to locate the symbol
2015-05-26 15:05:01 +03:00
Alexander Udalov 34c6af0039 Advance stub and JVM ABI versions due to function type reform 2015-05-26 15:04:58 +03:00
Alexander Udalov 7f0b5029eb Refactor KotlinBuiltIns#isFunctionType/isExtensionFunctionType 2015-05-26 15:04:58 +03:00
Alexander Udalov 6a0a703539 Delete numbered ExtensionFunction classes and generation logic 2015-05-26 15:04:57 +03:00
Alexander Udalov 49004a8b8e Conform functions to extension functions and vice versa
#KT-5989 Fixed
2015-05-26 15:04:56 +03:00
Alexander Udalov 4141e0a8df Introduce fictitious numbered Function class descriptors 2015-05-26 15:04:54 +03:00
Alexander Udalov 27ed098467 Introduce kotlin.jvm.internal.Lambda, superclass for all lambdas
It has its arity precomputed, as opposed to the future KFunctionImpl inheriting
from FunctionImpl, for which the computation of arity can take some time and so
it shouldn't be passed in the constructor and saved as a field
2015-05-26 15:04:54 +03:00
Alexander Udalov 86ecb423f6 Drop generic parameters from FunctionImpl classes in JVM runtime
They are not used in any way but cause some complex code in JVM back-end
2015-05-26 15:04:53 +03:00
Alexander Udalov 135ee92966 Minor, don't pass constants as parameters 2015-05-26 15:04:52 +03:00
Alexander Udalov 738a84e259 Temporary hack to migrate functions to package kotlin.jvm.functions
Add a file in package 'kotlin.jvm.functions' to the project and replace
explicit imports of functions 'kotlin.Function{n}' to two imports 'kotlin.*'
and 'kotlin.jvm.functions.*', so that the codebase can be compiled both by the
old and by the new compiler
2015-05-26 15:04:34 +03:00
Alexander Udalov b574c1d205 Move 23 function classes to package kotlin.jvm.functions, drop KFunction* 2015-05-26 14:27:41 +03:00
Alexander Udalov f6178ad7dd Introduce Function, KFunction interfaces and 'extension' annotation 2015-05-26 14:27:40 +03:00
Alexander Udalov 45c28abfee Keep built-in metadata for reflection interfaces
Reflection interfaces (interfaces in kotlin.reflect.* in core/builtins/) are
now fully considered as built-ins and can be accessed via KotlinBuiltIns. This
increases runtime size by ~20kb, but only because KotlinBuiltIns is static and
is therefore constructed only via resource loading from the compiler classpath
at the moment. As soon as it's possible to inject KotlinBuiltIns to the
particular resolution process, the metadata on JVM will be loaded via standard
annotation mechanism (kotlin.jvm.internal.KotlinClass/KotlinPackage) and wasted
runtime space will be reclaimed
2015-05-26 14:27:38 +03:00
Ilya Gorbunov 1cf4a407d1 JS: Provide MIN_VALUE and MAX_VALUE member constants for Double and Float companion objects.
JVM: Make MIN_VALUE and MAX_VALUE not an extension but member constant properties of Double and Float companion objects.
2015-05-26 00:26:19 +03:00
Pavel V. Talanov e4c242e66b Remove direct usages of ModuleDescriptor#getPackageFragmentProvider() 2015-05-25 13:00:16 +03:00
Pavel V. Talanov 23dabf595a J2k for PackageViewDescriptorImpl: prettify 2015-05-25 13:00:15 +03:00
Pavel V. Talanov 3bca284e1b J2k for PackageViewDescriptorImpl: autoconvert 2015-05-25 13:00:15 +03:00
Pavel V. Talanov 5ff4765e3d J2k for PackageViewDescriptorImpl: rename file 2015-05-25 13:00:14 +03:00
Michael Nedzelsky 6b64dcc4ee JvmProtoBuf: reuse one instance of ExtensionRegistryLite 2015-05-21 02:30:35 +03:00
Michael Nedzelsky ea8234adb9 convert JvmProtoBufUtil.java to kotlin, step 2: convert content 2015-05-21 02:30:32 +03:00
Michael Nedzelsky 2a6cd3dd96 convert JvmProtoBufUtil.java to kotlin, step 1: rename extentsion 2015-05-21 02:30:27 +03:00
Pavel V. Talanov cfdb1f4ec3 Refactor creation of ModuleDescriptor
Add storageManager to ModuleDescriptorImpl (to be used later)
Extract ModuleParameters to hold default imports and platform class map
Introduce MutableModuleContext to simplify module creation code
2015-05-20 19:45:50 +03:00
Denis Zharkov 5297b4974f Adjust descriptor renderer to latest parsing changes
- `constructor` keyword expected in primary constructor with non-empty modifier list
- annotation list should be preceeded by '@'
2015-05-20 09:24:56 +03:00