Commit Graph

28077 Commits

Author SHA1 Message Date
Alexander Udalov d4664af4e5 Get rid of originalToVariableSubstitutor and descriptorToVariable
Move the composite substitutor to GenericCandidateResolver where it was used,
other places don't need it since they know the exact call (or NO_CALL), the
substitutor for which should be used
2015-11-18 16:40:48 +03:00
Alexander Udalov cb05a8d58d Don't use originalToVariableSubstitutor in supertype constraints 2015-11-18 16:40:48 +03:00
Alexander Udalov 178ca3daae Add call to type variable and mapping descriptor -> variable
Since type parameter descriptor represents a single declaration of a type
parameter, multiple variables in one system may correspond to one type
parameter (e.g. in case of nested calls). Hence it's not possible to map type
parameters uniquely onto type variables and additional information is required
2015-11-18 16:40:47 +03:00
Alexander Udalov fc73e8c620 Move original descriptor to TypeVariable, minimize usages of freshTypeParameter 2015-11-18 16:40:46 +03:00
Alexander Udalov c1bd430b27 Introduce TypeVariable to abstract the system from descriptors
Store cached type and isExternal in type variable instead of sets in the
constraint system
2015-11-18 16:40:46 +03:00
Alexander Udalov 27ce61a3be Always alpha-convert non-external type parameters before registering in system 2015-11-18 16:40:45 +03:00
Alexander Udalov 4d5d24a503 Minor, move out check against no expected type 2015-11-18 16:40:45 +03:00
Alexander Udalov e50eb50299 Make getNestedTypeVariables() an utility 2015-11-18 16:40:44 +03:00
Alexander Udalov dd4a7ac6a9 Make ConstraintSystem work with variables, provide API to map to descriptors 2015-11-18 16:40:43 +03:00
Alexander Udalov 13abc265ad First steps to make distinction between variables and descriptors in ConstraintSystem
A type variable is an entity, the value of which should be solved by the
system; a descriptor is an actual TypeParameterDescriptor declaration
2015-11-18 16:40:43 +03:00
Alexander Udalov eeb925f127 Minor, sort out visibilities & move utilities in constraint system 2015-11-18 16:40:42 +03:00
Alexander Udalov 89dfd52363 Remove ConstraintSystem.partialSubstitutor, move logic to FuzzyType 2015-11-18 16:40:42 +03:00
Alexander Udalov d72a4c8037 Cleanup constraint system, convert functions to properties, delete unused 2015-11-18 16:40:41 +03:00
Alexander Udalov 3484c049d1 Rename ConstraintSystemSnapshot -> ConstraintSystemImpl 2015-11-18 16:40:40 +03:00
Alexander Udalov 265c135e89 Rename ConstraintSystemImpl -> ConstraintSystemBuilderImpl 2015-11-18 16:40:40 +03:00
Alexander Udalov bb918a2742 Move mutating methods of ConstraintSystem to Builder
Extract immutable ConstraintSystemSnapshot from ConstraintSystemImpl
2015-11-18 16:40:39 +03:00
Alexander Udalov d320922e08 Add more methods to interface ConstraintSystem
To minimize usages of ConstraintSystemImpl
2015-11-18 16:40:38 +03:00
Alexander Udalov 9149668286 Add ConstraintSystem#copy to minimize usages of ConstraintSystemImpl 2015-11-18 16:40:38 +03:00
Alexander Udalov 393852bf70 Simplify signature of ConstraintSystem#registerTypeVariables
Drop unused variance from TypeBounds and ConstraintSystem, provide default
values, inline methods used only once
2015-11-18 16:40:37 +03:00
Alexander Udalov 8cc484bc25 Cleanup GenericCandidateResolver 2015-11-18 16:40:37 +03:00
Dmitry Petrov 99b411c8ca companionObjectType --> classValueType
(NB: it IS NOT a companion object in case of OBJECT or ENUM_ENTRY)
Unify related names.
2015-11-18 16:27:26 +03:00
Dmitry Petrov 7b432c878a Diagnostics improvements for corner cases
(class/package qualifier in non-qualifier position).
2015-11-18 16:27:21 +03:00
Dmitry Petrov ba8372cc11 Fixes for IDE tests after qualifier modifications:
- CallType should look into QUALIFIER,
 so that completion works for (companion) object qualifiers.
- Record type and reference target for object qualifiers (not only for companions).
- "Create (function/...)" should understand ClassQualifier as possible receiver.
- Cleanup after rebase on master.
2015-11-18 14:35:54 +03:00
Dmitry Petrov 9856af48ca Drop createQualifier: testData update 2015-11-18 14:35:53 +03:00
Dmitry Petrov 28d15e776a Drop createQualifier.
NB: some regression in diagnostics for special cases,
such as class or package used in expression position or in safe access;
see next commit.
2015-11-18 14:35:53 +03:00
Dmitry Petrov b532fa2bbf Properly resolve values in 1st qualifier part (see implicitReceiverProperty test).
Look into QUALIFIER for left-most "unrolled" qualified expression
    in CallExpressionResolver#getQualifiedExpressionTypeInfo.
Drop some unused functions.
2015-11-18 14:35:53 +03:00
Dmitry Petrov 49570ba1ea Drop QualifierReceiver::resultingDescriptor. Use REFERENCE_TARGET. 2015-11-18 14:35:53 +03:00
Dmitry Petrov eef8c7ae09 Move auxiliary methods for QualifierReceiver resolution to a separate file
(to be refactored later).
Get rid of duplicate type usage validation.
2015-11-18 14:35:53 +03:00
Dmitry Petrov 3556f9751e Reuse package/class qualifier prefix resolution for qualified expression resolution. 2015-11-18 14:35:52 +03:00
Dmitry Petrov 5ff2ffbccc Move resolve* methods from Qualifier.kt to QualifiedExpressionResolver.
Further differentiate various qualifiers.
2015-11-18 14:35:52 +03:00
Dmitry Petrov 16dcc0b288 Introduce Receiver as a common superclass of QualifierReceiver and ReceiverValue.
QualifierRecevier is no longer a subclass of ReceiverValue.
2015-11-18 14:35:52 +03:00
Nikolay Krasko 2ff0b13808 Run psi check on light classes from compiled Kotlin 2015-11-18 13:34:25 +03:00
Dmitry Jemerov 9e0ec80c6a Merge branch 'KT-1396' of https://github.com/mcgee/kotlin into mcgee-KT-1396 2015-11-17 18:49:44 +01:00
Dmitry Jemerov 0e1dff1c29 optimize PackageIndexUtil.packageExists() by using in-memory hash table instead of stub index lookup 2015-11-17 18:47:01 +01:00
Dmitry Jemerov bf35099e0c use "destructuring declarations" term instead of "multi-declarations" 2015-11-17 18:43:26 +01:00
Anton Sukhonosenko bec6621654 #KT-1396 Fixed 2015-11-17 19:33:18 +03:00
Michael Nedzelsky ba47bfa752 Fix some weird cases when 'from' descriptor sourceElement is not a KotlinSourceElement 2015-11-17 18:23:12 +03:00
Mikhail Glukhikh fe13f39de9 Use of uninitialized variables in lambdas / object literals / local functions is forbidden now #KT-4475 Fixed
Local declarations CFA: variable initialization information before them is now taken into account
2015-11-17 18:21:09 +03:00
Zalim Bashorov 89791dc85c Batch recording lookups in daemon 2015-11-17 17:25:38 +03:00
Zalim Bashorov 6305bbda5d Fix tracking lookups when compile using daemon 2015-11-17 17:25:37 +03:00
Dmitry Jemerov 49db4e93c0 Merge branch 'KT-5115' of https://github.com/mcgee/kotlin into mcgee-KT-5115 2015-11-17 15:14:00 +01:00
Denis Zharkov a2627431f8 Minor. Cleanup and refine naming 2015-11-17 16:27:02 +03:00
Denis Zharkov fa99ea1e98 Generate type-safe barrier in method body
In cases when signature of special bridge is the same as current method,
but type is not 'Any?'.

Also there is tiny optimization:
only null check needed if value parameter type is mapped to Object,
but it's not nullable.

 #KT-9973 Fixed
2015-11-17 16:27:02 +03:00
Denis Zharkov 1f704e0c4d Minor. Split BytecodeText tests about special builtin bridges 2015-11-17 16:27:02 +03:00
Denis Zharkov 3b2719735e Setup default values for type-safe bridges
#KT-9973 In Progress
2015-11-17 16:27:01 +03:00
Denis Zharkov 34518c0ecc Extract common logic into generateIsCheck 2015-11-17 16:26:29 +03:00
Denis Zharkov f5a086140e Refine special bridge generating rule
Generate special bridge even in case current class has Kotlin superclass implementing
this builtin method, but that super class was generated without special bridge
(e.g. because it would have the same signature)

 #KT-9901 Fixed
2015-11-17 15:41:49 +03:00
Denis Zharkov abf7ae547e Minor. Move tests 2015-11-17 15:41:48 +03:00
Dmitry Jemerov 83bf5daf7f do not package kotlin-runtime and kotlin-reflect into Kotlin Android extensions zip 2015-11-17 12:24:15 +01:00
Mikhail Glukhikh 7e5558c8a2 More receiver refactoring 2015-11-17 13:02:25 +03:00