Commit Graph

920 Commits

Author SHA1 Message Date
Victor Petukhov b69fb6779f Basic support of partially specified type arguments though a new underscore operator for type arguments
^KT-13394
2021-11-01 12:25:07 +03:00
Victor Petukhov 64c682f465 Remove constraints containing stub types after completion of the common system of a builder inference call
^KT-49285 Fixed
2021-10-26 19:37:59 +03:00
Victor Petukhov e0a4704c21 Revert "Make freshly substituted type variables def not nullable if they come from not null type parameter"
This reverts commit 41936a790b37bef45d7e7dad851856ea1750ef01.
2021-10-26 19:37:58 +03:00
Victor Petukhov 836c6b280d Make freshly substituted type variables def not nullable if they come from not null type parameter
^KT-48778 Fixed
2021-10-26 19:37:57 +03:00
Victor Petukhov 02d06b6390 Transform VisibilityError diagnostic for callable references to further report it on the corresponding argument of a base call
^KT-46437 Fixed
2021-10-26 19:37:57 +03:00
Victor Petukhov e34b2d1850 Have common KotlinCallArgument for CompatibilityWarningOnArgument 2021-10-26 19:37:56 +03:00
Irene Dea 78ee6b2a09 Extend CandidateInterceptor to intercept ResolvedCallAtom candidate 2021-10-14 18:32:03 +03:00
Victor Petukhov abd2507107 Don't discriminate generics during callable references resolution
^KT-49038 Fixed
2021-10-01 22:09:33 +03:00
Victor Petukhov 43a83dd07a Don't add LHS type constraint for callable references too early, before the resolution
The constraint depends on a resolution candidate, because it can be Java static or companion object's member (don't need add constraint in this case)

^KT-41978 Fixed
2021-10-01 13:33:21 +03:00
Alexander Udalov dbd28142d0 Fix callable reference adaptation for vararg in fake override
`mappedVarargElements` are populated with parameters from
`argumentMapping`, which is computed using `ArgumentsToParametersMapper`
which calls `original` on all value parameters (see
ArgumentsToParametersMapper.kt:136).

So the code that adds empty lists for unassigned vararg parameters
should also call `original`. Otherwise, in the added test, we ended up
with two arguments for the parameter `s` in `id(::base1)`, one for
`Base.s` containing the correct value, and another for `Derived.s`
containing the empty list. Psi2ir took the last one, which resulted in
empty array being passed to the vararg parameter.

Note that all of this is caused by the fact that `original` of a fake
override parameter is the parameter of the base function. This seems
suspicious because `original` of a fake override _function_ is that fake
override itself (NOT the base function), but this would probably be very
risky to change at this point.

 #KT-48835 Fixed
2021-09-30 14:08:38 +02:00
Denis.Zharkov 4733a0d970 Refine naming: *TypeVariable -> *TypeParameter 2021-09-30 14:36:27 +03:00
Victor Petukhov ee728b6902 Use the new type inference for top-level callable reference resolution
^KT-47797 Fixed
^KT-47987 Fixed
^KT-45034 Fixed
^KT-48446 Fixed
^KT-13934 Fixed
2021-09-27 16:12:27 +03:00
Victor Petukhov ca13aea26a Creating resolved and resolution atoms for callable references 2021-09-27 16:12:25 +03:00
Victor Petukhov 764361bc42 Format and remove unused imports and variables 2021-09-27 16:12:22 +03:00
Victor Petukhov 8b85b4630b Write LHS resolution result into a call position 2021-09-27 16:12:20 +03:00
Victor Petukhov f1803b49fe Extract KotlinCallKind into separate file 2021-09-27 16:12:09 +03:00
Victor Petukhov 4559558001 Extract SimpleCandidateFactory into separate file 2021-09-27 16:12:08 +03:00
Victor Petukhov 7b9ef0be12 Introduce ResolutionCandidate by commonization KotlinResolutionCandidate and CallableReferenceCandidate
Also introduced SimpleErrorResolutionCandidate
2021-09-27 16:12:06 +03:00
Victor Petukhov 08060aa036 Extract CallableReferencesCandidateFactory into separate file 2021-09-27 16:12:05 +03:00
Victor Petukhov 4fcb16b4c4 Extract CallableReferenceCandidate into separate file 2021-09-27 16:12:04 +03:00
Victor Petukhov dedac63a8c Extract KotlinResolutionCandidate into separate file 2021-09-27 16:12:03 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Dmitry Savvinov 699eb47834 Never suggest fake overrides as results of expects-matching
See KT-48291 for example.

The rationale behind the change is that in "findExpectForActual" we want
to find a candidate to be a counterpart for the current (actual)
declaration. Fake overrides can not be a sensible counterpart in that
regard (you can't, nor you should, provide actual for expect which is
FAKE_OVERRIDE)

^KT-48291 Fixed
2021-09-08 16:22:54 +03:00
Dmitry Savvinov d6cb96aa24 Wire proper KotlinTypeRefiner into ClassicTypeSystemCotextForCS
^KT-48589 Fixed
2021-09-06 12:06:26 +03:00
Denis.Zharkov 019001ca20 Optimize memory footprint related to empty/single element collections
^KT-47926 Related
2021-08-30 16:51:55 +03:00
Dmitriy Novozhilov 7e6e0a3dd6 Remove all type system-specific inheritors of TypeCheckerState 2021-08-26 10:08:51 +03:00
Dmitriy Novozhilov e07512a847 Delegate refineType and prepareType in TypeCheckerState to special services
This is needed to add ability to create type system independent TypeCheckerState
2021-08-26 10:08:51 +03:00
Dmitriy Novozhilov 8b5548df49 Rename AbstractTypeCheckerContext to TypeCheckerState 2021-08-26 10:08:51 +03:00
Victor Petukhov a1519b7b4e Be able to infer a type variable based on several builder inference lambdas
^KT-48329 Fixed
2021-08-20 01:28:12 +03:00
Victor Petukhov bf1e68a53f Resolve calls using the builder inference despite the presence of the annotation if there are uninferred type variables
^KT-48194 Fixed
2021-08-20 01:28:11 +03:00
Victor Petukhov 55811c8851 Don't use builder inference if possible
The builder inference is running only if there are still uninferred type variables

^KT-48193 Fixed
2021-08-20 01:28:10 +03:00
Victor Petukhov 3df5667a4b Split variables fixation and reporting "not enough type infromation" in the type system completer into two parts 2021-08-20 01:28:06 +03:00
Victor Petukhov 261a04b587 Rename "coroutine( inference) *" stuff into "builder inference *" 2021-08-20 01:28:05 +03:00
Victor Petukhov 7567597be6 Java nullability checker: take type arguments' types from resolution atom if possible, instead of from resolved call directly
^KT-47833 Fixed
2021-08-04 17:36:51 +03:00
Pavel Kirpichenkov 19467861c9 [MPP] Fix false positive expect-actual mismatch
Use type refiner to correctly expand actual type alias - expect
class chains, produced by the commonizer. In a case when type
refiner doesn't exist for module create a one-shot thread local
instance. This might happen with modules without source code
in project (coming from build system model).

^KT-46691 Fixed
2021-07-28 18:57:08 +03:00
Dmitriy Novozhilov f3116cb64a Fix NON_EXHAUSTIVE_WHEN_STATEMENT warnings in project code 2021-07-20 13:33:46 +03:00
Dmitriy Novozhilov 6e83820f97 Move ExpectActualCompatibility to :compiler:resolution.common 2021-07-20 10:33:33 +03:00
Victor Petukhov 6a1ec92d39 Introduce specific error for calls which could be resolved only with unrestricted builder inference
^KT-47747 Fixed
2021-07-16 19:32:36 +03:00
Victor Petukhov 357fda2efa Initialize builder inference lambda anyway, even a call is inapplicable
^KT-47744 Fixed
2021-07-16 19:32:35 +03:00
Victor Petukhov c2cf2f36cd Implement inferring materialized self types through a default type in ResultTypeResolver 2021-07-09 19:21:04 +03:00
Victor Petukhov 3787099a38 Put the type inference on calls with self types under the compiler flag 2021-07-09 19:20:56 +03:00
Victor Petukhov 51c5a54e31 Support type inference for self type materialization calls 2021-07-09 19:20:54 +03:00
Mikhail Zarechenskiy 44cf4be1e5 Inference for some kind of self types 2021-07-09 19:20:52 +03:00
Victor Petukhov c3a5a7754d Use proper applicability for constraint warnings
^KT-47316 Fixed
2021-07-09 14:07:01 +03:00
Tianyu Geng ce767046eb FIR checkers: report SMARTCAST_IMPOSSIBLE 2021-06-10 16:01:13 +03:00
Victor Petukhov 124a14c8df Use separate constraint position during call substitution as part of inferring postponed type variables
^KT-47052 Fixed
^KT-47082 Fixed
2021-06-03 12:37:17 +03:00
Dmitriy Novozhilov 796f8e6bce Revert "FIR checkers: report SMARTCAST_IMPOSSIBLE"
This reverts commit 84334b08
2021-06-03 09:48:50 +03:00
Tianyu Geng 84334b087c FIR checkers: report SMARTCAST_IMPOSSIBLE 2021-06-02 13:19:12 +03:00
Alexander Udalov bcf47ddc94 Move optional annotation utilities to module 'resolution'
To avoid depending on a heavy module 'frontend' in parts of the compiler
where checking for optional annotations is needed, such as in
'ir.serialization.common'.
2021-06-01 20:28:22 +02:00
Victor Petukhov 9fd1cbd2e7 Inject stub type variables of a different builder inference call properly 2021-05-28 15:36:19 +03:00