Commit Graph

5072 Commits

Author SHA1 Message Date
pyos ee921412fc FIR: intersect return types of declarations in intersection scopes
^KT-54378 Fixed
2022-10-14 08:25:26 +00:00
Ivan Kochurkin 1deb253bac [FIR] Run FirSupertypesChecker for anonymous objects, ^KT-54300 Fixed 2022-10-13 18:11:49 +00:00
Ivan Kochurkin 9c6df5313a [FIR] Fix substitution of anonymous type's supertypes, ^KT-51418 Fixed 2022-10-13 18:11:47 +00:00
vladislav.grechko 817afcd4af KT-MR-7307 review fixes 2022-10-13 15:19:10 +00:00
Denis.Zharkov 31ba1f1534 Add deprecation warning for false-negative TYPE_MISMATCH
See KT-49404 for details

In K1, within SubstitutingScope we approximate almost all the types
containing captured types are being approximated to either a lower or
an upper bound.

While mostly, it's being done correctly there are some problems with
approximations for flexible types

So, the parameter's type of A<in Any>::foo is approximated to Inv<in Any!>,
thus allowing to use Inv<*>, while it's obviously unsound.

NB: For the similar example, in B, there are regular TYPE_MISMATCH
because parameter for B<in Any>::foo is approximated to Nothing

Also, it's important to say that
- in K2 everything works because we don't use type approximation there
- approximation algorithm that works incorrectly is only being used in K1

^KT-54332 Fixed
2022-10-12 20:53:02 +00:00
pyos 2ec264cfa2 FIR CFG: filter out variables declared inside lambdas more eagerly 2022-10-12 11:56:02 +00:00
Pavel Mikhailovskii f4bdf54601 KT-8575 Fix warnings for Java synthetic properties 2022-10-10 22:03:58 +00:00
vladislav.grechko e0c8142106 Support of custom 'equals' and 'hashCode' in inline classes
'equals' from any made available for overriding in inline classes
'typed' equals made available for definition in inline classes
'typed' equals definition made compulsory if 'untyped' is overridden
'operator' keyword is allowed in 'typed' equals definition

^KT-24874: Fixed
2022-10-10 16:52:34 +00:00
Nikolay Lunyak b6f950ed75 [FIR][FE 1.0] KT-47933: Warn about redundant @Repeatable
Merge-request: KT-MR-7318
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2022-10-07 13:33:49 +00:00
pyos 46d7b66e59 FIR CFG: remove liveness analysis from lambda reassignment analyzer
Handling try/catch and break/continue is too hard here, and failing to
do that properly can create incorrect smartcast. Better be conservative
and assume all code is live.
2022-10-07 08:56:05 +00:00
pyos 3160470201 Minor: change a test to be more precise 2022-10-07 08:56:04 +00:00
pyos a9ae1fcdf9 FIR CFG: handle loops and try/catch when analyzing smartcasts in lambdas
See KT-50092
2022-10-07 08:56:04 +00:00
pyos d054617b8e FIR CFG: handle reassignments with explicit receivers more precisely
When a looping control structure has a reassignment with an explicit
receiver, we don't need to erase its smartcast info as it has to be a
non-local property and is thus automatically unstable anyway. However,
we should still do that upon reaching the assignment itself for slightly
more precise error messages (as the property not just "could be"
reassigned, but *has been* reassigned already).
2022-10-07 08:56:03 +00:00
pyos 77c2601382 Add a test where a local variable has the same name as a property 2022-10-07 08:56:02 +00:00
Dmitriy Novozhilov c0ad67c4f9 [FIR] Generate java declarations for record components of java records
^KT-53964 Fixed
2022-10-03 15:48:17 +03:00
Nikolay Lunyak fcd3e4f4c5 [FIR JS] KT-51740: Alter positioning of NO_VALUE_FOR_PARAMETER 2022-09-30 21:39:20 +03:00
Ilya Kirillov 556b7894d5 [Low Level FIR] do not search for declarations from kotlin. package in source modules 2022-09-30 12:15:49 +02:00
Mikhail Glukhikh bcd7a531b9 K2: filter invisible overridden in status resolver & FIR2IR
Related to KT-53197
2022-09-29 08:34:13 +00:00
pyos 3a5d75fd22 K2: introduce platform-specific visibility checks for overrides + tests
Related to KT-53197
2022-09-29 08:34:13 +00:00
Mikhail Glukhikh 1ad2ec302b FirOverrideChecker: don't report VIRTUAL_MEMBER_HIDDEN with invisible
#KT-53197 Fixed
2022-09-29 08:34:12 +00:00
Mikhail Glukhikh 9f7c465eb0 FE: add test for KT-53197 2022-09-29 08:34:11 +00:00
Nikolay Lunyak f578381726 [FIR] KT-46483: Forbid annotations in where Clauses
Merge-request: KT-MR-7208
Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
2022-09-28 13:38:18 +00:00
Ilmir Usmanov 4a10dbf383 FE: Warn about generic inline class parameter in LV < 1.8
#KT-54192 Fixed
2022-09-27 16:50:43 +00:00
Dmitry Khalanskiy 4cbee3cde7 Fix KT-51478
The issue was that, when various context elements were available
to fulfill a need for an extension receiver, but none of them were
applicable to it, the compiler behaved the same way as if there
was no extension receiver at all.

https://youtrack.jetbrains.com/issue/KT-51478/Inapplicable-receiver-diagnostic-expected-when-there-are-two-context-receiver-candidates
2022-09-20 10:32:32 +00:00
Mikhail Glukhikh a4b2a8c4ea AbstractTypeChecker: fix special case with CapturedType as self type argument
#KT-53908 Fixed
May fix also KT-53271
2022-09-19 19:12:21 +00:00
Mikhail Glukhikh a70c4f15d6 K2: make not implemented checker more close to K1 logic
#KT-54049 Fixed
2022-09-16 07:15:43 +00:00
Mikhail Glukhikh fe38089205 FE: add test reproducing KT-54049 2022-09-16 07:15:43 +00:00
Mikhail Glukhikh c4a48927d2 K1: report ABSTRACT_SUPER_CALL(_WARNING) also for 2+ steps to intersection
#KT-53953 Fixed
2022-09-16 07:15:43 +00:00
Mikhail Glukhikh 3e5d5bcaa7 FE: add test reproducing KT-53953 2022-09-16 07:15:42 +00:00
Dmitriy Novozhilov 09429ff432 [FIR] Fix reporting of UNINITIALIZED_ENUM_COMPANION in all places 2022-09-16 07:12:20 +00:00
Dmitriy Novozhilov a2c12aa711 [FE] Always report UNINITIALIZED_ENUM_COMPANION_WARNING
^KT-54055
2022-09-16 07:12:19 +00:00
Dmitriy Novozhilov 3a5a6e5587 [FE] Add test for KT-54055 2022-09-16 07:12:19 +00:00
Dmitriy Novozhilov b86d5cf21a [FE] Postpone ProhibitAccessToEnumCompanionMembersInEnumConstructorCall till 1.9
^KT-49110
2022-09-16 07:12:19 +00:00
Pavel Mikhailovskii f643cdf90b Target KT-4107 (data objects) to Kotlin 1.9 2022-09-15 12:23:40 +02:00
Mikhail Glukhikh fb9b1ad0dc K1: implement warning for upper bound violated in type alias constructors
Partially implements KT-47473
2022-09-15 08:51:46 +00:00
pyos a0fa2cc275 FIR: regenerate LL API tests 2022-09-14 08:11:05 +00:00
pyos be5c4a91a4 FIR/FE1.0: keep flexibility when approximating local types 2022-09-14 08:11:04 +00:00
pyos adcbc5ec99 FE1.0: keep nullability when approximating local types (in 1.9)
Report an error that inference will change and type has to be provided
manually in other language versions, since the current behavior is an
unsoundness that can cause runtime NPEs while the new behavior may
silently change overload resolution.

^KT-30054 Fixed
2022-09-14 08:11:04 +00:00
pyos 062308c7c1 FIR: keep nullability when approximating local types
^KT-30054 Open
2022-09-14 08:11:04 +00:00
Ivan Kochurkin 6c4dafc23c Disable IgnoreNullabilityForErasedValueParameters for indefinite time, ^KT-53751 Fixed 2022-09-13 16:45:06 +00:00
Mikhail Glukhikh 5fcb18ac2b Revert "[FE 1.0] Resolve this and super calls through the new type inference infra"
This reverts commit bab8047bb3.
2022-09-13 09:09:01 +00:00
Mikhail Glukhikh f35cebbc25 Revert "[FE 1.0] Resolve special construct calls through the new type inference infra"
This reverts commit e66cc9a639.
2022-09-13 09:09:01 +00:00
Mikhail Glukhikh fc0058d471 Revert "[FE 1.0] Resolve constructor calls through the new type inference infra"
This reverts commit 0070c234ce.
2022-09-13 09:09:00 +00:00
Mikhail Glukhikh a9b8f6715b Revert "[FE 1.0] Resolve setters through the new type inference infra"
This reverts commit 6e191147b9.
2022-09-13 09:09:00 +00:00
Mikhail Glukhikh 8be08d903b Revert "K1: don't report UNRESOLVED_WITH_TARGET on hidden setters"
This reverts commit e20efc1398.
2022-09-13 09:08:59 +00:00
Pavel Mikhailovskii fe5a6fd511 Disallow non-local break/continue in crossinline lambdas 2022-09-12 13:26:19 +00:00
Mikhail Glukhikh 769a2ca9b1 K1: report ENUM_DECLARING_CLASS_DEPRECATED on enum entry properly
#KT-53807 Fixed
2022-09-12 10:45:23 +00:00
Alexander Udalov 686cd82327 Serialize OptIn to builtins, improve tests
Skip SOURCE-retention annotations in builtins serialization tests,
because otherwise the source analysis result can't be equal to the
metadata deserialization result.

 #KT-53073 Fixed
2022-09-09 21:31:39 +02:00
Mikhail Glukhikh e02fd8f4a8 FE: don't run builder inference in UNTIL_FIRST_LAMBDA mode
#KT-52927 Fixed
2022-09-09 12:44:39 +00:00
Pavel Mikhailovskii 85ab8b4ce1 KT-53783 Prohibit "expect data object" syntax 2022-09-07 12:53:24 +00:00