Commit Graph

686 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 379c6944a2 NI: extract diagnostics from partially resolved call instead of separately handling it including running all checks
^KT-37630 Fixed
^KT-35494 Fixed
2020-05-22 22:13:53 +03:00
Dmitry Petrov de4ebe4395 Prohibit @JvnName on functions mangled because of return type 2020-05-20 07:19:29 +03:00
Denis Zharkov 687a58843f FIR: Rewrite visibility checking
Unbound it from implicit receiver stack as it only needs scope structure/declaration nestedness
Semantics for protected has been changed in a way it works in old FE

NB: We should report additional diagnostic in case of CallCompanionProtectedNonStatic.fir.kt
(see KT-38814)
2020-05-15 16:04:44 +03:00
Victor Petukhov 73dec25eb1 NI: intersect DFI types before capturing
^KT-37887 Fixed
2020-05-14 19:54:59 +03:00
Alexander Udalov ea413cefb4 Remove TypeOfChecker for JVM frontend
This is needed to support typeOf with non-reified type parameters.

 #KT-30279
2020-05-13 10:04:26 +02: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
Mikhail Zarechenskiy 36f6ccffde Add test for obsolete issue
#KT-38667 Obsolete
2020-05-08 15:42:43 +03:00
Jinseong Jeon 7b01cf7b04 FIR: handle labeled super reference properly 2020-05-07 12:02:56 +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
Mikhail Bogdanov 4f7599076c Postpone JvmDefault deprecation. Revert "Deprecate @JvmDefault"
This reverts commit c11f3868
2020-05-04 10:02:16 +02: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
Denis Zharkov c6ae423816 Add tests for KT-35468
^KT-35468 Fixed
2020-04-29 09:17:54 +03:00
Mikhail Zarechenskiy 11390d9de3 Add test for obsolete issue
#KT-38420 Obsolete
2020-04-27 01:55:39 +03:00
Nick 96238cbe1f [FIR] Support diagnostic QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE 2020-04-24 16:48:28 +03:00
Mikhail Zarechenskiy 537a59d6ca Introduce basic suspend conversion in FE
#KT-15917 In Progress
2020-04-22 16:10:44 +03:00
rapturemain 8960829c01 [FIR] Cast error on the element name instead of the whole body 2020-04-20 17:27:16 +03:00
rapturemain 6d63de01ac [FIR] Fix effective visibility calculation & relevant test data 2020-04-20 17:25:26 +03:00
Pavel Kirpichenkov b91cf13259 [NI] Fix expicit super receiver check
^KT-37497 Fixed
2020-04-20 10:56:13 +03:00
Mikhail Zarechenskiy befa1e114c Add tests for obsolete issues
#KT-38092 Obsolete
 #KT-38179 Obsolete
 #KT-35105 Obsolete
 #KT-36696 Obsolete
 #KT-36947 Obsolete
 #KT-37337 Obsolete
 #KT-37309 Obsolete
 #KT-37727 Obsolete
 #KT-37735 Obsolete
 #KT-37853 Obsolete
 #KT-37920 Obsolete
 #KT-37709 Obsolete
 #KT-37706 Obsolete
2020-04-20 04:10:37 +03:00
Dmitriy Novozhilov 7f02d57d88 [FIR] Correctly detect super type in delegated constructor call 2020-04-17 12:37:29 +03:00
Dmitriy Novozhilov 2e4183db7d [FIR-TEST] Update testdata of old FE contracts tests 2020-04-15 11:13:01 +03:00
Mikhail Bogdanov c11f38688e Deprecate @JvmDefault 2020-04-09 07:37:31 +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
Mikhail Zarechenskiy 38a719cb22 [NI] Fix trace manipulations for builder inference and ::-expressions
For a class literal Type::class we are resolving Type as a constructor,
 getting all diagnostics (about missing arguments, for example) and then
 just not committing this trace with errors

 #KT-37626 Fixed
2020-03-31 15:50:58 +03:00
Mikhail Glukhikh 7bfd354a77 Don't report UNUSED_PARAMETER in main from object #KT-37718 Fixed 2020-03-27 16:46:59 +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
simon.ogorodnik f83c20065d [FIR-test] Unmute passing tests, mostly fir2ir 2020-03-24 18:58:19 +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 ec4d9d2f1f [NI] Prefer between two complex variables one with proper lower bounds
This reverts commit d4d35bb766.
2020-03-24 11:13:55 +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
Mikhail Zarechenskiy d4d35bb766 Revert "[NI] Prefer between two complex variables one with proper lower bounds"
This reverts commit ced8a92629.
2020-03-22 17:16:22 +03:00
Dmitriy Novozhilov 5f9f01fe4e [FIR] Implement new completion mode calculator
Note that `testDelegates` now fails due to KT-37638 and
    `testSimpleIn` fails due to problems with type parameters
    of inner classes
2020-03-20 23:11:28 +03:00
Dmitriy Novozhilov ea02855ba6 [FIR] Fix type arguments and substitution for flexible types 2020-03-20 23:11:28 +03:00
Mikhail Zarechenskiy ced8a92629 [NI] Prefer between two complex variables one with proper lower bounds
#KT-37554 Fixed
2020-03-20 15:44:53 +03:00
Denis Zharkov 7203499b7a FIR: Fix visibility check for protected within a companion 2020-03-17 16:33:48 +03:00
simon.ogorodnik 4844a90788 [FIR] KT-37453: Type argument mapping
#KT-37453 Fixed
2020-03-16 21:41:59 +03:00
Ilya Chernikov 70c89a28e1 Stop subtyping constraint search if equality constraints for...
all not fixed type vars are found
#KT-35626 fixed
2020-03-12 08:02:45 +01:00
Alexander Udalov d668808b44 Migrate Experimental->RequiresOptIn in project sources 2020-03-10 12:07:15 +01:00
Alexander Udalov 795d6ab407 Migrate UseExperimental->OptIn in project sources 2020-03-10 12:07:14 +01:00
Dmitriy Novozhilov af67aff303 [FIR] Support Clonable
#KT-36762 Fixed
2020-03-06 10:44:14 +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 985311d9f0 [FIR] Implement delegate inference 2020-03-02 09:49:29 +03:00
Dmitriy Novozhilov 296ee2da4a [FIR] Support @LowPriorityInOverloadResolution annotation 2020-03-02 09:49:28 +03:00