Commit Graph

850 Commits

Author SHA1 Message Date
Pavel Kirpichenkov c68a4bdc0f [MPP] Consider expect-actual inline/value classes interchangeable
^KT-44926 Fixed
2021-03-01 19:25:31 +03:00
Simon Ogorodnik 3909e3c54c Decouple TypeCheckerContext and TypeSystemContext 2021-02-15 18:28:58 +03:00
Victor Petukhov f797ee7803 Substitute captured types with inner intersection one (NewTypeSubstitutor)
^KT-44651 Fixed
2021-02-11 14:20:14 +03:00
Victor Petukhov 670f029bdf Allow passing non-spread arrays into a vararg parameter after sam properly, through propagating vararg element type to a sam adapter from the original parameter descriptor 2021-01-28 13:19:31 +03:00
Victor Petukhov 8bd78064be Do substitution of a type enhancement, not only lower and upper bounds
^KT-44439 Fixed
2021-01-25 12:14:34 +03:00
Dmitriy Novozhilov 025ec8e8b1 Add FQ_NAME postfix to OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION 2020-11-11 09:52:55 +03:00
Denis Zharkov 07ed89b02b Move OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION to compiler.common
So, it could be used in FIR
2020-11-03 18:30:15 +03:00
Victor Petukhov c6da2a1138 Reuse built functional types for postponed arguments by expected types and paths from a top level type variable
^KT-42221 Fixed
2020-10-16 10:46:22 +03:00
Pavel Kirpichenkov 39a87435ee [FIR/NI] Refactor type variable gathering from lambda types
Motivation:
- drop getArguments from type context as a duplicate of getArgumentList
- reduce the number of collection allocations in getAllDeeplyRelatedTypeVariables

Additional minor improvements, test data fixes
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov 712a2ce1ab [FIR] Improved lambda completion: initial implementation
Repeat the logic of KotlinConstraintSystemCompleter in ConstraintSystemCompleter.
Implement additional context operations required for updated lambda completion algorithm.
2020-10-13 11:00:21 +03:00
Pavel Kirpichenkov 5eae6f2f4e [FIR] Move PostponedArgumentInputTypesResolver to resolution.common 2020-10-13 11:00:20 +03:00
Pavel Kirpichenkov 3822a32fce [FIR] Prepare commonization of PostponedArgumentInputTypesResolver 2020-10-13 11:00:20 +03:00
Victor Petukhov 6c1dc43d25 Add check already fixed variables in PostponedArgumentInputTypesResolver during adding constraints on them and using inside a functional type
^KT-42374 Fixed
2020-10-02 18:31:54 +03:00
Pavel Kirpichenkov 8f31b1ca83 [FIR] Use default language settings in inference components
Without settings common inference components require additional parameters
to be passed explicitly from components not shared between FIR and FE10.
Proper configuration can be postponed in FIR, defaults are good enough for now.

^KT-42080 In progress
2020-09-29 18:22:56 +03:00
Victor Petukhov 25ea3df5ca Put fix in 9123c4f73baf77f8a50dede6c890c46f5ffafd6c under the inference compatibility flag 2020-09-23 17:15:58 +03:00
Pavel Kirpichenkov fdc134ff66 [NI] Use compatibility mode for KT-41934 2020-09-22 15:06:12 +03:00
Dmitriy Novozhilov 7f692be11e [FIR] Properly detect callable reference type according conversions 2020-09-11 12:13:33 +03:00
Victor Petukhov bcd33da6f8 Don't check an argument type during passing it to vararg in the named form to avoid false positives if the argument type is type variable yet
^KT-41144 Fixed
2020-09-10 19:38:26 +03:00
Victor Petukhov 685d16ec68 NI: don't do substitution for unsupported callable descriptors to use as callable references
^KT-41729 Fixed
2020-09-09 18:00:41 +03:00
Dmitriy Novozhilov cd557ad178 Change order of enum entries in CandidateApplicability 2020-09-09 12:38:34 +03:00
Dmitriy Novozhilov d1568c1ce6 Rename ResolutionCandidateApplicability to CandidateApplicability 2020-09-09 12:38:33 +03:00
Pavel Kirpichenkov f8ee976720 Use union of all available descriptors in composite importing scope 2020-09-07 18:52:10 +03:00
Pavel Kirpichenkov 5892bdf3f4 Extend import resolution for library-to-source analysis
Use composite importing scope for references when resolution anchors are enabled.
Composite scope provides additional descriptors from scope of resolution anchor module.
Overriding old importing scope with a new one is not possible as it breaks library
dependencies on other libraries, which are inaccessible in anchor scope (scope for sources).

KT-24309 In Progress
2020-09-07 18:52:10 +03:00
Dmitriy Novozhilov d1fd1da56f Rename Visibility to DescriptorVisibility 2020-09-04 11:07:42 +03:00
Mikhail Zarechenskiy 9c217e3d99 Reuse revised variables during lambda analysis against type variables
#KT-41400 Fixed
2020-09-01 13:04:53 +03:00
Dmitriy Novozhilov 07c353973d Move requireOrDescribe to :core:compiler.common 2020-09-01 12:00:11 +03:00
Dmitriy Novozhilov f010dc533c Move Variance.convertVariance to :core:compiler.common 2020-09-01 12:00:11 +03:00
Pavel Kirpichenkov 2979c37001 [NI] Fix resolution status for UnstableSmartCastDiagnostic
RESOLVED_WITH_ERROR was initially added for reproducing OI behavior.
The intention was to preserve resolution into unstable smart cast and to keep failing candidate.
However, this idea was abandoned after OI behavior proved inconsistent in cases involving generics.

This commit restores RUNTIME_ERROR status of UnstableSmartCastDiagnostic.

^KT-41357 Fixed
2020-09-01 11:21:13 +03:00
Pavel Kirpichenkov 873224dfbc [NI] Use new type substitutor for known type parameters
Use known type parameters substitutor after substitutor for fresh variables.
The old logic of substituions had the following order:
- replace known type parameters
- replace type parameters with type variables
- complete inference
- replace type variables with inferred types

According to the updated logic, replacement goes as follows:
- replace type parameters with type variables
- replace known type parameters; if they were variables, this will effectively remove them from inference
- complete inference
- replace remaining type variables with inferred types

Support projection substitution in new type substitutor.
It is needed for correct interaction with old type substitutor.
Old type substitutors can contain mappings constructor -> projection
which couldn't be expressed correctly with existing substitutor API in some cases.

^KT-41386 Fixed
2020-08-31 17:53:46 +03:00
Dmitriy Novozhilov 148e8fe76e Move FlatSignature to :compiler:resolution.common 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov 64766e125c Move common inference classes to :compiler:resolution.common 2020-08-28 10:59:53 +03:00
Dmitriy Novozhilov 068d21635e [NI] Get rid of KotlinType usages in MutableConstraintStorage.kt 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov af0df35623 [NI] Get rid of FE 1.0 types in ConstraintInjector 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov ad039a28bd [NI] Get rid of left FE 1.0 types in NewConstraintSystemImpl 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov 6914aba5c2 [NI] Commonize detection of @OnlyInputTypes in NewConstraintSystemImpl 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov 64f0ee21c1 Get rid of FE 1.0 classes usage in ConstraintIncorporator 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov 1050f7f066 Extract PostponedResolvedAtomMarker to separate file 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov 1cadabb099 Extract ResolutionCandidateApplicability to separate file 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov 775df6dfc3 [NI] Get rid of FE 1.0 type usages in ResultTypeResolver 2020-08-28 10:59:52 +03:00
Dmitriy Novozhilov aae1681b76 [NI] Get rid of ResolvedAtom usage in ConstraintSystemCompletionContext 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov 11e8552861 [NI] Get rid of PostponedArgumentInputTypesResolver.Context 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov 970a2581a1 [NI] Extract PostponedArgumentsAnalyzerContext from PostponedArgumentsAnalyzer 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov b15f847943 [NI] Extract common parts from KotlinConstraintSystemCompleter 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov 12fbb93871 [NI] Extract FE 1.0 specific part from NewCommonSuperTypeCalculator 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov b21a0213df [NI] Get rid of FE 1.0 types in AbstractTypeApproximator 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov 527c5a771d [NI] Get rid of FE 1.0 types in AbstractTypeCheckerContextForConstraintSystem 2020-08-28 10:59:51 +03:00
Dmitriy Novozhilov 686c17a234 [NI] Rename NewConstraintSystem.diagnostics to errors 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov 59b2cb6393 [NI] Split KotlinCallDiagnostics and inference errors to different hierarchies 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov fae21d4db3 Introduce frontend independent constraint positions 2020-08-28 10:59:50 +03:00
Dmitriy Novozhilov e5e3d7cab1 Extract FE 1.0 related parts from NewConstraintSystem 2020-08-28 10:59:50 +03:00