Commit Graph

23951 Commits

Author SHA1 Message Date
Zalim Bashorov f7ccb3819e JS: don't pollute object with $metadata$
#KT-8126 Fixed
2015-07-13 15:52:57 +03:00
Alexander Udalov 4de2c5a5c8 Don't generate default no-args constructor for enums
#KT-8438 Fixed
2015-07-13 11:59:35 +03:00
Alexey Sedunov 064b03ca3f Minor: Suppress error message to fix compilation against Java 8 2015-07-11 14:10:36 +03:00
Alexey Sedunov 969183fbf3 Control-Flow: Move type predicate computation out of control-flow analysis 2015-07-10 21:09:07 +03:00
Alexey Sedunov 34cd2e0ac3 Refactoring: Replace factory functions with constructors 2015-07-10 21:09:06 +03:00
Alexander Udalov 290983687d Fix generation of bridges for lambdas
#KT-8447 Fixed
2015-07-10 20:10:16 +03:00
Dmitry Petrov 5dc28f1313 KT-7507 Check expected type for class literal expression 2015-07-10 20:10:15 +03:00
Dmitry Petrov d540ff8890 KT-8206 java.lang.NoSuchFieldError: $kotlinClass for deprecated::class
Instantiate class literals for annotation classes as foreign.
2015-07-10 20:10:15 +03:00
Alexander Udalov 95f5d24988 Use a built-in marker class for Configure Kotlin action
This helps to get rid of the balloon which was shown in Kotlin project itself
because of the recent change where a source root was added to the module
'builtins', which doesn't have the class kotlin.jvm.internal.Intrinsics (the
'runtime.jvm' module does)
2015-07-10 20:10:15 +03:00
Alexander Udalov 670565b251 Wrap property reference instance before storing to static field 2015-07-10 20:10:14 +03:00
Alexander Udalov 16b5b95556 Test equals/hashCode/toString for function references 2015-07-10 20:10:14 +03:00
Alexander Udalov f8815d9450 Test visibility of anonymous classes for callable references 2015-07-10 20:10:13 +03:00
Alexander Udalov 3b2be6212d Add some tests on Java property references 2015-07-10 20:10:13 +03:00
Alexander Udalov c62f19ee82 Move getterName/setterName to JvmAbi
Reuse in RuntimeTypeMapper in reflection
2015-07-10 20:10:13 +03:00
Alexander Udalov 64d8e35d26 Remove ScriptParameterResolver, inline its single method 2015-07-10 20:10:12 +03:00
Alexander Udalov 9b832d4b87 Container of value parameter is always a callable 2015-07-10 20:10:12 +03:00
Alexander Udalov 636b63a8c5 Make "reflection not found" a warning, provide a quick fix
Reporting the warning on each "::", as ReflectionNotFoundInspection did, is not
correct anymore, because for example name/get/set on properties works perfectly
without kotlin-reflect.jar in the classpath. So instead we report the warning
on calls to functions from reflection interfaces. This is not perfect either
because it's wrong in projects with custom implementations of reflection
interfaces, but this case is so rare that the users can suppress the warning
there anyway

 #KT-7176 Fixed
2015-07-10 20:10:11 +03:00
Alexander Udalov 4f1247f03f Support property getters/setters in reflection 2015-07-10 20:10:10 +03:00
Alexander Udalov 749d0c4a52 Minor, simplify KProperty.accessible 2015-07-10 20:10:10 +03:00
Alexander Udalov fd198accf6 Rename internal field/getter/setter properties in KPropertyImpl
To avoid clash with getter/setter which will appear soon in KProperty interface
2015-07-10 20:10:10 +03:00
Alexander Udalov 048a9b686e Generate separate anonymous class for each property reference
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
2015-07-10 20:10:09 +03:00
Alexander Udalov 30794060a9 Simplify property hierarchy in reflection
Leave only 3*2 = 6 classes: KProperty0, KProperty1, KProperty2 and their
mutable analogs, depending on the number of receivers a property takes
2015-07-10 20:10:09 +03:00
Alexander Udalov c3b97e0668 Simplify function hierarchy in reflection
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
2015-07-10 20:10:08 +03:00
Alexander Udalov 3549e1e035 Add KFunction.name, support reflection for function references
#KT-7694 Fixed
2015-07-10 20:10:07 +03:00
Alexander Udalov ab297a4da0 Generate reflection info to classes for function references
The information includes the owner (class, package, script, or null for local
functions) and the JVM signature -- this information will be used by reflection
to locate the symbol
2015-07-10 20:10:07 +03:00
Alexander Udalov bc168c0cba Support KClass.jvmName = java.lang.Class.getName() 2015-07-10 20:10:07 +03:00
Alexander Udalov 236214305f Support KClass.qualifiedName for non-local classes 2015-07-10 20:10:06 +03:00
Alexey Sedunov df07a61a08 Control-Flow: Generate instruction for left-hand side of invalid assignments
#KT-8390 Fixed
2015-07-10 19:27:53 +03:00
Svetlana Isakova d2dc44379e Changed default value for 'getNestedTypeVariables()' 2015-07-10 15:05:12 +03:00
Svetlana Isakova 722a49767a Rename: TypeConstructorMismatch -> ParameterConstraintError 2015-07-10 15:05:12 +03:00
Svetlana Isakova 016a8f69da Removed check for position when storing initial top-level constraints 2015-07-10 15:05:11 +03:00
Svetlana Isakova 425a9516db Minor. Rename: typeParameterBounds -> localTypeParameterBounds 2015-07-10 15:05:11 +03:00
Svetlana Isakova 4701310852 Removed unnecessary check to prevent infinite recursion in incorporation 2015-07-10 15:05:11 +03:00
Svetlana Isakova 92e7ed0425 Rename: getNestedTypeArguments -> getNestedArguments 2015-07-10 15:05:10 +03:00
Svetlana Isakova 3c698992e0 Generate specific type inference error
only for bounds from 'parameter' positions (receiver & value arguments).
They can be marked as error (with red color) explicitly later.

Replaced getSystemWithoutWeakConstraints() with filterConstraintsOut(TYPE_BOUND_POSITION)
2015-07-10 15:05:10 +03:00
Svetlana Isakova 4c8b75928e Added tests
#KT-6179 Fixed
  #KT-8132 Fixed
2015-07-10 15:05:10 +03:00
Svetlana Isakova fc69cf1b5e Added more tests on incorporation 2015-07-10 15:05:09 +03:00
Svetlana Isakova 4c1eedce3b Added tests for incorporation with nullable type parameter 2015-07-10 15:05:09 +03:00
Svetlana Isakova d1e9f00e5f Removed obsolete type parameter substitution logic
when copy constraint system
2015-07-10 15:05:09 +03:00
Svetlana Isakova f25f59bb6e Solve the constraint system for alpha-converted variables,
store initial and backward conversions for
substituting new constraints and the result
2015-07-10 15:05:08 +03:00
Svetlana Isakova a714de783f Converted CallResolverUtil to kotlin 2015-07-10 15:05:08 +03:00
Svetlana Isakova 517c2b3520 Rename to kt: CallResolverUtil 2015-07-10 15:05:08 +03:00
Svetlana Isakova b8526e7048 Added diagnostic tests for inference and incorporation 2015-07-10 15:05:07 +03:00
Svetlana Isakova 086e69e132 Added tests for obsolete tasks 2015-07-10 15:05:07 +03:00
Svetlana Isakova 690a46bbb4 Removed obsolete use of resolution results cache
the other usage is still relevant
2015-07-10 15:05:07 +03:00
Svetlana Isakova 89e16ecbcc Don't generate constraint if a type variable was substituted twice
to prevent infinite recursion
2015-07-10 15:05:06 +03:00
Svetlana Isakova 3b85ac90ba Check initial constraints in constraint system status 2015-07-10 15:05:06 +03:00
Svetlana Isakova 4c4f99c356 Use approximation of captured types in incorporation
to generate new constraints
2015-07-10 15:05:06 +03:00
Svetlana Isakova c6e698e18d Minor: simplified code
Used BoundKind.ordinal()
2015-07-10 15:05:05 +03:00
Svetlana Isakova ac578f7e5b Cache type corresponding to type variable 2015-07-10 15:05:05 +03:00