Commit Graph

74 Commits

Author SHA1 Message Date
Victor Petukhov a84780fefb NI: Add regression test for KT-38799
The issue has been fixed by introducing the modified postponed arguments analysis (KT-37952)
2020-05-25 11:56:08 +03:00
Victor Petukhov 73dec25eb1 NI: intersect DFI types before capturing
^KT-37887 Fixed
2020-05-14 19:54:59 +03:00
Victor Petukhov 11d05c1abd NI: propagate isNullabilityConstraint flag into constraint injector and inherit it
^KT-37510 Fixed
2020-05-12 16:15:07 +03:00
Pavel Kirpichenkov 003ba1c8f5 [NI] CST: add preemptive recursion detection
For single super type constructor create star projection argument when types for that argument are equal to the original types.
Captured star projections are replaced with their corresponding supertypes during this check.
Skip check for `in` parameters, for which recursive cst calculation does not happen.
Adjust constant in fallback recursion condition.

^KT-38544 Fixed
2020-05-12 11:13:43 +03:00
Victor Petukhov 260683c20e NI: Improve postponed arguments analysis
Introduce seven stages:
1) Analyze postponed arguments with fixed parameter types
2) Collect parameter types from constraints and lambda parameters' declaration
3) Fix not postponed variables for parameter types of all postponed arguments
4) Create atoms with revised expected types if needed
5) Analyze the first ready postponed argument and rerun stages if it has been analyzed
6) Force fixation remaining type variables: fix if possible or report not enough information
7) Force analysis remaining not analyzed postponed arguments and rerun stages if there are

^KT-37952 Fixed
^KT-32156 Fixed
^KT-37249 Fixed
^KT-37341 Fixed
2020-05-07 11:42:00 +03:00
Ilya Chernikov 45ac81c585 Do not check type depth for constrains generated on subtyping
#KT-38143 fixed
2020-04-29 11:12:21 +02:00
simon.ogorodnik f573719cc1 [FIR] Fix missing receiver type if anonymous function without label 2020-04-08 14:56:17 +03:00
Victor Petukhov 6eb2875690 [FIR-TEST] Actualize test added in 661812b255 2020-04-07 13:51:36 +03:00
Victor Petukhov 661812b255 NI: add test for KT-37628 2020-04-07 11:31:29 +03:00
Pavel Kirpichenkov e39b69839b [NI] Make constraint check for type variables with complex dependency
Additional check for trivial constraints is needed to make lambda
analysis before outer variable fixation to Nothing(?)

^KT-37627 Fixed
2020-03-26 17:06:37 +03:00
Pavel Kirpichenkov adf3351a8b [NI] Don't skip constraints with projections during variable fixation
Those constraints are only restored for variable fixation stage because of the
influence on pefrormance.

^KT-37650 Fixed
^KT-37380 Fixed
2020-03-24 16:13:49 +03:00
Mikhail Zarechenskiy 191fb02bf6 [NI] Consider intersection type with number type as Nothing
Currently, only for "in": In<in Int & A> == In<in Nothing> == In<*>

 #KT-37302 Fixed
2020-03-23 16:39:21 +03:00
Pavel Kirpichenkov dc42b20ae3 [NI] Use alternative to intersection type in public declarations
The new inference uses inferred intersection types normally, unlike the old inference.
However, intersection types in public declarations are approximated to supertype, which
potentially may give a less presice type, then it would be with the OI.
For non-related T1, T2 the NI approximates {T1 & T2} to Any in public declarations,
and if the OI was inferring T1 instead of the intersection type, it may lead to
less precise declaration type and related errors.

The solution is to remember an alternative for an intersection type when present.
Before approximation the alternative replaces the intersection type.

^KT-36249 Fixed
2020-03-05 20:20:47 +03:00
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Pavel Kirpichenkov 23ed6c4a1f [NI] Narrow nullability constraint check in incorporator
This commit is a hotfix rather then proper solution.
The source of the issue is that currently type variable fixation result
may change due to fixation order alteration for variables with the same priority.
For instance, having variables V1, V2, and proper types Type1, Type2, such that:
V1 <: Type1
V1 <: V2
Type2 <: V2
both variables will be fixed either to Type1, if V1 will be fixed first,
or to Type2 otherwise.

Since this limitation cannot be easily overcome, the taken approach is to remove
incedental constraint added after 2d5a0546 by restricting nullability constraint check
to `Nothing?` constraints only, thus postponing problematic variable fixation.
To clearify, additional constraint is correct and should cause no harm (in ideal world),
but currently its presence changes fixation order.
So without the restriction the previously used constraint from fixed outer variable
is no longer available by the time problematic variable type is being selected.

^KT-37043 Fixed
2020-03-03 12:57:25 +03:00
Dmitriy Novozhilov 70ee51d88c [FIR] Add anonymous objects to CFG 2020-03-02 09:49:29 +03:00
Dmitriy Novozhilov 296ee2da4a [FIR] Support @LowPriorityInOverloadResolution annotation 2020-03-02 09:49:28 +03:00
Mikhail Zarechenskiy cbbbf40b90 [NI] Fix isSuccessful property for member with LowPriority resolution
The problem was introduced in e40ba73950
2020-02-19 18:06:22 +03:00
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00
Mikhail Glukhikh dc7621a112 [FIR] Fix Java override ambiguity (Kotlin type parameter VS Java Object) 2020-02-11 16:09:20 +03:00
Mikhail Glukhikh 22068dd6ad [FIR TEST] Update test data due to hardened receiver check (NB: broken)
In particular, nullable invoke extension call and some smart casts
are broken here
2020-02-03 16:45:21 +03:00
Denis Zharkov 676c99b933 NI: Fix exception during callable references overload resolution
^KT-35847 Fixed
2020-01-16 10:49:49 +03:00
Pavel Kirpichenkov 2a4e235e34 [NI] Decrease only input types check diagnostic level to warning 2020-01-10 13:05:40 +03:00
Dmitriy Novozhilov e83941a98e [NI] Don't resolve delegates twice
#KT-31219 Fixed
#KT-31679 Fixed
#KT-32249 Fixed
2019-12-26 10:54:06 +03:00
Pavel Kirpichenkov 7ee71450bc [NI] Discriminate Nothing? result type from nullability constraints
Nullability constraints should not be chosen when proper
argument constraints for variables in contravariant position present.

^KT-32106 Fixed
^KT-33166 Fixed
2019-12-25 14:59:06 +03:00
Dmitriy Novozhilov 7fed7a840b [NI] Update some testdata broken in NI 2019-12-20 11:17:47 +03:00
Pavel Kirpichenkov ebb9f09656 [NI] Fix issues with star projection uncapturing
Prevent stack overflow during uncapturing of star projection
for parameter with recursive upper bound.
Uncapture star projections for flexible type parameters with
respect to flexible upper bound.

^KT-35210 Fixed
2019-12-18 16:19:33 +03:00
Pavel Kirpichenkov 86dc0925b1 [NI] Preserve constraint position for OnlyInputType during incorporation
Variable with complex dependency on other variable loses its
original constraint position when variable it depends on is fixed.
To prevent that, original input position is saved in incorporation
position.
2019-12-18 16:19:33 +03:00
Pavel Kirpichenkov 2fc79856a2 [NI] Fix OnlyInputTypes for captured types
Uncapture projections recursively for cases when captured type is not
top-level type or first level type argument
2019-12-18 16:19:32 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Pavel Kirpichenkov afd59f0d46 [NI] Fix 'only input type' check for intersection types
Check worked incorrectly in case when argument type and expected type are the
same intersection type, which is possible for local variables without explicit
type declaration.
2019-11-21 15:59:26 +03:00
Mikhail Zarechenskiy 5582fd4056 [NI] Discard DefNotNull types inside invariant positions
#KT-30297 Fixed
 #KT-32168 Fixed
 #KT-27722 Fixed (actually, it was fixed with addition of DefNotNullTypes, and now test was added to save this behavior)
 #KT-32345 Fixed
2019-11-06 15:20:17 +03:00
Mikhail Zarechenskiy 6eefea6715 Add tests for obsolete issues
#KT-32395 Obsolete (fixed in 42a5c488)
 #KT-32388 Obsolete (fixed in f3e4c9cd)
 #KT-32271 Obsolete (fixed in 60a0cf1)
2019-07-06 10:06:04 +03:00
Mikhail Zarechenskiy 42a5c488c1 [NI] Fix OnlyInputTypes annotation support for top-level captured types
#KT-32157 Fixed
 #KT-32116 Fixed
 #KT-32235 Fixed
 #KT-32218 Fixed
2019-07-01 12:59:35 +03:00
Mikhail Zarechenskiy 4ddd9f081b [NI] Consider explicitly specified type argument as an input type
#KT-31860 Fixed
2019-06-07 12:31:42 +03:00
Dmitriy Novozhilov e574106799 [NI] Support @OnlyInputTypes annotation. #KT-29307 fixed 2019-05-29 10:54:41 +03:00
Dmitriy Novozhilov 0f7e91ff6d [NI] Update testdata for stdlib diagnostic tests 2019-05-29 10:53:34 +03:00
Dmitriy Novozhilov 139497bafb [NI] Add checking @NotNull parameters for candidates 2019-05-29 10:53:07 +03:00
Dmitriy Novozhilov 96a3831feb [NI] Add capturing receiver type for callable references
#KT-30292 Fixed
2019-05-16 10:50:30 +03:00
Mikhail Zarechenskiy 516fccbe7b [NI] Complete call if return type contains only "good" type variables 2019-05-08 12:19:52 +03:00
Mikhail Zarechenskiy 61bd3a8d03 [NI] Complete call if return type has proper lower or equal constraints
There was a silly bug: equal constraint is actually a lower and an upper
 constraint, but we checked only presence of lower constraints.

 Test is important as here we have one equal constraint and should
 complete inner call `foo<Int>()` without propagating it to `bar` to
 avoid using `NoInfer` annotation multiple times
2019-05-08 12:19:50 +03:00
Mikhail Zarechenskiy 1e3db9ee7c [NI] Update test data for diagnostic tests 2019-04-25 16:19:37 +03:00
Dmitriy Novozhilov e70bdb51c5 [NI] Automatically squash equal diagnostics in OI and NI in testdata 2019-04-19 10:53:19 +03:00
Dmitriy Novozhilov 1ac3542036 [NI] Decrease priority of Integer Literal Types in type checking
#KT-30446
2019-03-29 11:55:30 +03:00
Dmitriy Novozhilov d01b6ef900 Revert "[NI] Support @OnlyInputTypes annotation. #KT-29307 fixed"
This reverts commit 90628112
With that annotation there is complex bug that breaks build of Kotlin compiler
2019-03-18 18:53:38 +03:00
Dmitriy Novozhilov 9062811231 [NI] Support @OnlyInputTypes annotation. #KT-29307 fixed
Also KT-26698 fixed in new inference
2019-03-15 10:39:11 +03:00
Dmitriy Novozhilov 0501a108c0 Fix tests in DiagnosticsTestWithStdLibGenerated with NI 2019-02-01 11:40:20 +03:00
Mikhail Zarechenskiy 66a00f442c Add tests for obsolete issues
#KT-12008 Obsolete
 #KT-11881 Obsolete
 #KT-10822 Obsolete
2018-09-11 12:34:09 +03:00
Valentin Kipyatkov ec51076355 DescriptorRenderer to render annotations for all types + separate option to render annotation arguments + use it in IdeDescriptorRenderers 2016-10-11 23:38:54 +03:00
Stanislav Erokhin 01430b4b99 Create hack for exception about "Empty intersection for types".
Hackaround for KT-11266, EA-79963, EA-72093,  EA-79976.
2016-06-17 01:39:44 +03:00