Commit Graph

40257 Commits

Author SHA1 Message Date
Knize 389c7d03b7 KT-6676 Show enum ordinal in quickdoc (#1165)
KT-6676: Show enum ordinal in quickdoc

 #KT-6676 fixed
2017-07-14 22:28:16 +03:00
Simon Ogorodnik cc8933c82b KT-17074: Make completion respect DslMarker's
#KT-17074 fixed
2017-07-14 21:06:43 +03:00
Alexander Udalov 3c04ca4397 Update KotlinVersion.CURRENT to 1.1.5 2017-07-14 21:03:06 +03:00
Alexander Udalov 2611c7de7e Restore anonymous classes for local delegate metadatas in inline functions
The problem is that now that the local delegated property metadata is in
the $$delegatedProperties array of the containing class, the access to
it from code calling an inline function with a local delegated property
is illegal.

Currently it seems to be a lot of work to support this rather rare case
properly (see the comment in ExpressionCodegen.getVariableMetadataValue)
so we postpone it and return the old behavior of using the anonymous
KProperty subclass for metadata
2017-07-14 15:13:12 +03:00
Alexander Udalov 616d575fb6 Support reflection for local delegated properties
#KT-15222 Fixed
2017-07-14 15:13:12 +03:00
Alexander Udalov c444c4d10b Ignore $$delegatedProperties in light analysis mode tests
For tests with local delegated properties, this field is generated in
the full mode, but is not generated in the lite mode because local
variables are not analyzed properly in the lite mode
2017-07-14 15:04:05 +03:00
Alexander Udalov db27a885f1 Rework property metadata generation for local delegated properties
Instead of generating an anonymous class for each delegated local
variable, store metadatas in the $$delegatedProperties array of the
containing class, as is done for member properties
2017-07-14 15:04:05 +03:00
Alexander Udalov 9344f7f42f Remove unused and obsolete code in JVM backend 2017-07-14 15:04:05 +03:00
Alexander Udalov 728de91140 Refactor generation of metadata for delegated properties
In CodegenAnnotatingVisitor, store all delegated properties whose
metadata should be generated in each class (identified by ASM Type).
Use the stored information later, both in the $$delegatedProperties
array generation and in the access to it from property's accessor
methods, instead of an heuristical indexOfDelegatedProperty()
2017-07-14 15:04:04 +03:00
Alexander Udalov b97589b33e Remove CodegenBinding.LOCAL_VARIABLE_DELEGATE
Calculate this value at call sites explicitly instead
2017-07-14 15:04:04 +03:00
Alexander Udalov 66ea288be7 Minor, extract fakeDescriptorsForReferences.kt 2017-07-14 15:04:04 +03:00
Stanislav Erokhin 9e98c11114 [NI] Minor. Change return type substitute function to not null 2017-07-14 12:43:09 +03:00
Stanislav Erokhin 2602216039 [NI] Use NewTypeSubstitutor when create descriptor with fresh variables. 2017-07-14 12:43:09 +03:00
Stanislav Erokhin 652676dc71 [NI] Introduce transactions for constraint system.
This will be used for callable reference resolution.
2017-07-14 12:43:09 +03:00
Stanislav Erokhin cb494c46d7 [NI] Add initial constraint to IncorporationConstraintPosition 2017-07-14 12:43:08 +03:00
Stanislav Erokhin c767545d4c Minor. Remove unused CandidateWithBoundDispatchReceiver#copy 2017-07-14 12:43:08 +03:00
Stanislav Erokhin ac06060260 [NI] Minor. Drop unused CommonSupertypeCalculator 2017-07-14 12:43:08 +03:00
Stanislav Erokhin 0404fbc092 [NI] Minor. Rename LambdaAnalyzer to KotlinResolutionCallbacks 2017-07-14 12:43:08 +03:00
Dmitry Petrov 178e3e2c98 [NI] Update argument types on call completion using nested calls resolution 2017-07-14 12:43:07 +03:00
Dmitry Petrov 4448637727 [NI] Support calling abstract class constructor in delegating call 2017-07-14 12:43:07 +03:00
Dmitry Petrov 549e8ba668 [NI] Use ALWAYS_SUITABLE_RECEIVER when no receiver is available
(as in "old" resolution & inference)

This fixes issues with Java static members access.
2017-07-14 12:43:07 +03:00
Dmitry Petrov 2bdeef7970 [NI] Postprocess lambda result expressions on call completion
Should update type to denotable, e.g.,
IntegerValueType(x) to proper numeric type.

TODO extract common code into some ValueArgumentPostprocessor
2017-07-14 12:43:07 +03:00
Dmitry Petrov 1d6ed4ef8e [NI] Update lambda result types.
When completing calls, update return types for functional descriptors
for lambdas using type inference results.

Add toString to some Call subclasses (for debugging purposes).
2017-07-14 12:43:06 +03:00
Dmitry Petrov 2bf252afe6 [NI] Introduce lambda result dependency edges
Given a lambda result type R_L with constraint R_L <: T,
for each constituent type variable V in T with variance matching
approximation direction for V, consider a dependency edge V -> R
(lambda-result-dependency).

E.g., given a constraint:
    R <: Out<V>
where V is approximated down (to sub-type).
After R is fixed, we obtain constraint
    Out<T> <: Out<V>
which is incorporated as
    T <: V
which is a relevant constraint for V.
2017-07-14 12:43:06 +03:00
Dmitry Petrov 13e8720ddc [NI] Keep track of fresh type variables created for particular call candidate
Otherwise we can't obtain inferred type arguments for the call,
which is required for reification.
2017-07-14 12:43:06 +03:00
Dmitry Petrov eb7e9196b5 [NI] Fix some argument mapping problems
1. Value arguments for the resolved call are indexed with resulting
descriptor value parameters (which can be substituted).

2. Simple argument can be a single vararg element if the corresponding
value parameter is a vararg parameter.

3. Resulting descriptor should be approximated to super-type.
This doesn't affect type inference, but the JVM BE expects types with
proper classifiers.
2017-07-14 12:43:06 +03:00
Stanislav Erokhin 0c79949cf1 [NI] Implement NewTypeSubstitutor 2017-07-14 12:43:05 +03:00
Stanislav Erokhin ff8a57dc26 [NI] Implement New CommonSuperTypeCalculation 2017-07-14 12:43:05 +03:00
Stanislav Erokhin 6aac67aa7e [NI] Approximate captured types when set them into variable.
Also do not store type with captured type inside possible types.
It is hack for now, but without it captured types can flow to
resolution and exception will be thrown.
2017-07-14 12:43:05 +03:00
Stanislav Erokhin 397103f9d0 [NI] Fix smart cast for expression with captured input type. 2017-07-14 12:43:05 +03:00
Stanislav Erokhin 73cc1fdd9c [NI] Resolve type variable to Nothing for TO_SUBTYPE direction. 2017-07-14 12:43:04 +03:00
Stanislav Erokhin 6e24b0f89d [NI] Approximate captured types when we resolve type variable TO_SUPER. 2017-07-14 12:43:04 +03:00
Stanislav Erokhin 53caa84db9 [NI] Add constrains even we try add constraint like TypeVariable <: CapturedType from subtyping.
If such captured type has lower type, then from TypeVariable <: lowerType => TypeVariable <: CapturedType.
2017-07-14 12:43:04 +03:00
Stanislav Erokhin 657c332a1f [NI] Do not run "or" branches for constraint subtyping.
We should never do that, because otherwise we can get unexpected result.
  Example for input constraint: C(in String) <: T.
  If we run usual subtyping algorithm, then we get 2 constraints:
  C(in String) <: T and T <: String.
  Of course such system has contradiction.
2017-07-14 12:43:04 +03:00
Stanislav Erokhin 0fadf0bf70 [NI] Approximate captured types before type variable fixation.
We prefer denotable types when we solve constraint system.
I.e. if for T we have not equality constraint with captured type we can approximate captured type to denotable type.
2017-07-14 12:43:03 +03:00
Stanislav Erokhin b4bf534d29 [NI] Capture from supertypes of type parameter.
This works by accident in OI, so this should be supported by new inference.
2017-07-14 12:43:03 +03:00
Stanislav Erokhin c4ddc7a3a6 [NI] Store stub resolved call to trace because some clients read this before all calls are completed.
This is bad idea, but this is how it works in old inference.
Now we just save old behaviour.
Future plan: fix checks where we get unfinished resolved calls.
2017-07-14 12:43:03 +03:00
Stanislav Erokhin 78f8d29a4c [NI] Fix find maximally specific for NI. 2017-07-14 12:43:03 +03:00
Dmitry Petrov d67b51e91a [NI] Support wrong number of type arguments and integer constants.
- report WRONG_NUMBER_OF_TYPE_ARGUMENTS
- make integral types work again: IntegerValueType is represented as {Int & Byte & Short & Long} in the constraint system
2017-07-14 12:43:02 +03:00
Dmitry Petrov f5c59b1343 [NI] Report special error message on constant expression type mismatch. 2017-07-14 12:43:02 +03:00
Dmitry Petrov 5afd3e72d6 [NI] Report diagnostic on abstract class instantiation. 2017-07-14 12:43:02 +03:00
Stanislav Erokhin b012681a53 [NI] New inference -- initial commit. 2017-07-14 12:43:02 +03:00
Dmitry Petrov 036090be91 Support intersection type in TypeUtils.contains(...) 2017-07-14 12:43:01 +03:00
Stanislav Erokhin e8501c7d54 Add method replaceType for ReceiverValue.
This method will used for capturing from expressions before call resolution.
2017-07-14 12:43:01 +03:00
Nikolay Krasko 1dcdb72a49 Process UastContext service absence (EA-100670) 2017-07-14 12:39:13 +03:00
Dmitry Jemerov 448dba3f78 License-related cleanup 2017-07-14 11:09:45 +02:00
Ilya Chernikov 84a812df19 Drop forced in-process compilation (as interface compatibility is resolved) 2017-07-13 15:45:34 +02:00
Dmitry Jemerov 9b37e76b14 Don't trigger update check when an in-memory file is modified
#KT-18954 Fixed
2017-07-13 12:50:15 +02:00
Mikhail Zarechenskiy 2d3ce89afc Use only completed arguments of special call 2017-07-13 12:26:03 +03:00
Dmitry Petrov a687dea898 Introduce special IrDeclarationOrigin's for for-loop variables
FOR_LOOP_ITERATOR
 - temporary variable for for-loop iterator

FOR_LOOP_VARIABLE
 - `x` in `for (x in xs)`

FOR_LOOP_IMPLICIT_VARIABLE
 - temporary variable for for-loop with destructuring, e.g.:
   for ((x, y) in xys)
   =>
   for (tmp in xys) {
     val (x, y) = tmp
   }
2017-07-13 10:59:51 +03:00