Commit Graph

23933 Commits

Author SHA1 Message Date
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
Svetlana Isakova db8085c399 Incorporation tests 2015-07-10 15:05:05 +03:00
Svetlana Isakova 179c5e3c3a Add a constraint for nested call
if there are no bounds on variables in this call return type
2015-07-10 15:05:04 +03:00
Svetlana Isakova 1463ff7258 Updated constraint system tests 2015-07-10 15:05:04 +03:00
Svetlana Isakova cf64687b02 More accurate error reporting
with type inference error for delegated properties
Add the constraints from completer if they don't lead to errors
except errors from upper bounds to improve diagnostics
2015-07-10 15:05:04 +03:00
Svetlana Isakova 9a5abf368f Constraint incorporation
In a constraint system a new bound is incorporated:
all new constrains that can be derived from it
(and from existing ones) are added
2015-07-10 15:05:04 +03:00
Svetlana Isakova 82acce4767 Separate input and result data in constraint system test
input file: *.constraints
 result file: *.bounds
2015-07-10 15:05:03 +03:00
Svetlana Isakova 07937a27eb Added GenericCandidateResolver 2015-07-10 15:05:03 +03:00
Svetlana Isakova 0fdfb6b5db Render short names in constraint system tests 2015-07-10 15:05:02 +03:00
Svetlana Isakova 8b9cdd1751 Changes in TypeBounds interface
inlined 'isEmpty' (correctly)
  replaced functions 'getValue, getValues' with properties
2015-07-10 15:05:02 +03:00
Svetlana Isakova 5717148bd4 Changed test data
Added an extra blank line to rendered constraint system
2015-07-10 15:05:02 +03:00
Svetlana Isakova 918087f475 Don't render constraint positions in tests
for constraint system, it's always SPECIAL anyway
2015-07-10 15:05:02 +03:00
Svetlana Isakova f7dc59e2d6 Added 'UNKNOWN' argument mapping
for cases with no argument expression
2015-07-10 15:04:38 +03:00
Denis Zharkov 76648878e0 Ignore type parameters in value arguments while comparing SAM adapters
#KT-8388 Fixed
2015-07-10 08:46:27 +03:00
Alexey Sedunov aa34fe6352 Minor: Remove useless annotation 2015-07-10 01:28:54 +03:00
Alexey Sedunov f71f7dd4dd Minor: Drop unused classes 2015-07-09 20:47:57 +03:00
Alexey Sedunov f9b836e144 Change Signature: Error reporting for Java class without an explicit constructor 2015-07-09 20:47:54 +03:00
Alexey Sedunov a96bd546a1 Change Signature: Avoid explicit Unit return type 2015-07-09 20:47:51 +03:00
Alexey Sedunov eb7463ed81 Change Signature: Propagate parameters to chosen callers
#KT-7902 Fixed
2015-07-09 20:47:48 +03:00