Commit Graph

96 Commits

Author SHA1 Message Date
Dmitriy Novozhilov bd66b96f8a [FIR] Set EnhancedNullability attribute for former flexible types
In some cases we transform flexible type into non-flexible during
  enhancement, but don't add `@EnhancedNullability` attribute to them,
  which breaks consistency with K1 on IR level

This commit fixes it

^KT-65302
2024-02-21 12:04:11 +00:00
Kirill Rakhman 26fae9e83a [FIR] Allow declarations to override parts of non-trivial intersection
A class can inherit two declarations that are compatible from the
overridability standpoint and are therefore combined to a non-trivial
intersection.
At the same time, the class can declare a member declaration that
only overrides one of the intersection's members.
In this case, we break up the intersection and only add the overridden
parts to the declared member's direct overridden list.

If the class doesn't override the intersection, it exists as
intersection override, like before.

#KT-65487 Fixed
2024-02-20 09:02:39 +00:00
Kirill Rakhman dd1d36816b [FIR] Insert SAM conversion expressions during completion
#KT-62847 Fixed
2023-11-30 08:39:04 +00:00
Mikhail Glukhikh 0c61ce61c3 K2: for Java source override, don't compare return types in override checker
#KT-57044 Fixed
2023-11-21 18:11:58 +00:00
Mikhail Glukhikh be5a27dd6b K2: add test to confirm KT-56409 now works properly 2023-11-14 14:25:13 +00:00
Ivan Kochurkin d50c6f1b6d [FIR] Fix missing USELESS_CAST
`FirUselessTypeOperationCallChecker` always checks exact types matching for `as` operator

Simplify code of cast checker and utils

^KT-56629 Fixed
^KT-56615 Fixed
^KT-59820 Fixed
2023-10-24 20:59:56 +00:00
Ilya Kirillov d98da87278 [FIR] Render dot-separated FQNs instead of slash-separated ones in diagnostics
^KT-62030 fixed
2023-09-22 10:48:31 +00:00
Denis.Zharkov 034671ad78 K2: Update substituted member candidate if it contains type variables
See the comment at updateSubstitutedMemberIfReceiverContainsTypeVariable

It became necessary after delegate inference is rewritten, since before
that happened, stub types were being left there and FIR2IR handled
them accidentally properly because stub types are equal to anything.

But that wasn't really correct even there because stub types are not
intended to leak out of the FIR

^KT-61060
2023-09-08 07:11:48 +00:00
Mikhail Glukhikh 6ce096f0ed K2: handle extra value parameter in FirCallCompleter properly
#KT-60450 Fixed
2023-08-28 14:02:56 +00:00
Mikhail Glukhikh 8cbefcc26f K2: add test to ensure #KT-55981 Obsolete 2023-08-22 11:40:26 +00:00
Nikolay Lunyak f9c6af4d2a [FIR] Properly assign <local> packages to symbols
This prevents `FirConflictsExpressionChecker.kt`
from missing conflicting local functions. It used
to due to inconsistencies in assigning `<local>`,
and this commit makes it a bit more
straightforward.

The change in KtClassTypeQualifierRenderer
prevents `FirOverrideImplementTest.testLocalClass`
from failing in `intellij`. It didn't fail for
callables, because `KtCallableSignatureRenderer`
doesn't try to render packages.

^KT-59186 Fixed
2023-08-18 13:31:04 +00:00
Nikolay Lunyak bca44e5d8c [FIR] Prepend type variables with '+' rather than '_'
'++' is easier to notice than '__'.
'++++++' is easier to count than '######'.
2023-08-04 11:20:39 +00:00
Denis.Zharkov 01354c8ce5 K2: Fix false-positive resolution to j.l.String constructor
In K1 (see LazyImportScope), default start import with different
priority worked as follows:
- if something is found in HIGH, don't look at LOW
- otherwise, look at LOW

That, in particular, helped to avoid looking into JDK mirroring classes'
constructors like when resolving calls like String(...) because we
just don't look into j.l.String while already found kotlin.String

The change inside FirTowerResolveTask.kt is not made accidentally:
- At first, it's more or less obviously a bug fix because tower group
for hide-members candidate with implicit receiver should take into
account the tower level of the receiver itself.
- The change is attached to this commit because otherwise the test
at compiler/testData/diagnostics/testsWithStdLib/kt55503.kt starts
failing.
The bug was hidden because previously after finding a successful
`Sequence.forEach` candidate for the inner receiver
(at the default HIGH star import scope), resolver was continuing to
look into default LOW star import scope where it's frozen forever because
we had the better/closer candidate anyway.

But after this change with merging default star imports into the same
tower leve, resolver was continuing its job, enumerating implicit
receivers, finding List<Int> there and noticing that there's
a TopPrioritized hide-member candidates for them
(erroneously ignoring it has a worse/more far receiver).

^KT-51670 Fixed
2023-07-04 07:25:22 +00:00
Denis.Zharkov 3279313f2c K2: Fix priority for implicit receiver + extensionInvoke
See K1 counterpart at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.Task.processImplicitReceiver

^KT-58943 Fixed
^KT-59541 Fixed
2023-07-01 16:29:06 +00:00
Mikhail Glukhikh 978d52d05b K2: render additionally *s for static references
This commit allows to distinguish static VS non-static things
inside FIR_DUMP, e.g. static synthetic Enum.entries with
enum entry Enum.entries
2023-06-21 13:08:00 +00:00
Mikhail Glukhikh dc38ce24f7 K2: fix field annotation splitting and frontend checks
Related to KT-57135
2023-04-25 12:18:26 +00:00
Ivan Kochurkin a3e7a35cb1 [FIR] Create separated FirBlock for loop local val
Refactor FIR builders code for ForExpression
2023-03-21 20:24:57 +00:00
Dmitriy Novozhilov f44fcc811b [FIR] Set proper callable id for delegated members 2023-03-17 12:37:31 +00:00
Mikhail Glukhikh 58959951d3 K2: fix CCE during bound conversion for Java raw Kotlin-based type
#KT-56630 Fixed
2023-03-15 13:40:49 +00:00
Mikhail Glukhikh 5a9e8b3c0a FE: add tests for KT-53966 (positive/negative) 2023-02-08 17:40:20 +00:00
Mikhail Glukhikh aafde418cc K2: store imported static qualifiers in dispatch receiver field
This is a partial revert of commit 104fd4c1
#KT-55116 Fixed
2023-01-26 15:27:55 +00:00
Ilya Kirillov 1bbcae5ed2 [FIR] fix resolve contract violation from scopes
We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier

^KT-54890
^KTIJ-23587 fixed
2023-01-13 21:32:51 +00:00
Dmitriy Novozhilov b174bb8844 [FIR] Update testdata after introducing FirResolvedErrorReference 2022-12-15 12:12:19 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Steven Schäfer a7ba081d22 FIR: Fix interface delegation ABI
- Unifies the name of the `$$delegate_<n>` field between K1 and K2.
- Make the `$$delegate_<n>` field private
2022-12-02 21:54:18 +00:00
Mikhail Glukhikh 4dc7b6dddc K2: fix/universalize logic to determine that member is from Java 2022-11-11 13:30:40 +00:00
Mikhail Glukhikh 62ba1277bb K2: don't duplicate custom annotations in types #KT-54275 Fixed 2022-10-10 06:20:39 +00:00
Mikhail Glukhikh d491eba629 K2: add reproducer for KT-54275 2022-10-10 06:20:39 +00:00
Mikhail Glukhikh 85965d74f6 K2: fix implicit body resolve in case delegated property is on the path
#KT-54212 Fixed
2022-09-29 10:55:14 +02:00
Mikhail Glukhikh 75a29434bd K2: add reproducer of KT-54212 2022-09-29 10:55:04 +02:00
Mikhail Glukhikh e36091b926 K2: introduce even more readable renderer for types in messages
#KT-53343 Fixed
2022-09-13 09:05:48 +00:00
Mikhail Glukhikh 3848be596e Add test for KT-53343 2022-09-13 09:05:48 +00:00
Mikhail Glukhikh b4a92e8a56 Undeprecate @BuilderInference annotation #KT-52400 Declined 2022-08-17 14:07:13 +00:00
Mikhail Glukhikh 7333589663 K1/K2: add Enum.entries unconditionally and filter them out in tower
Before this commit, we added Enum.entries only in case when
LanguageFeature.EnumEntries was ON (with an exception in K1/Java case).
In this commit we add Enum.entries unconditionally, and in case
the language feature is OFF we filter them out during tower resolve.
2022-08-12 09:35:27 +00:00
Mikhail Glukhikh 38f4a35be2 FIR: introduce flexible types pretty rendering for no arguments case
#KT-52020 Fixed
2022-06-29 16:50:05 +00:00
Victor Petukhov fa7809cd80 [FE] Remove BuilderInference annotation from tests 2022-06-21 15:01:56 +02:00
Mikhail Glukhikh 065e852199 FIR: support more precise diagnostics about parameter names
#KT-52762 Fixed
2022-06-20 11:28:55 +00:00
Mikhail Glukhikh 9fbafc3eb9 Add test for KT-52762 2022-06-20 11:28:55 +00:00
Denis.Zharkov f70ae2df3a FIR: Refine inference constraints when type variable in flexible position
That issue might be fixed via changing
TypeVariableMarker.shouldBeFlexible at ConeConstraintSystemUtilContext
but this and some other tricks have been added because of incorrect
handling of constraints where type variable has a flexible bound

^KT-51168 Fixed
2022-05-19 16:53:59 +00:00
Ilya Kirillov b5ad6f5db4 [analysis api] move analysis session classes to separate packages, use KtAnalysisApiInternals to mark internal API 2022-05-12 16:15:14 +02:00
Ivan Kochurkin c6f52893fb [FIR] Fix inconsistent RETURN_TYPE_MISMATCH and TYPE_MISMATCH reporting on functions and properties
^KT-51203 Fixed
2022-04-05 15:50:43 +00:00
Mikhail Glukhikh 70366c3bcb FIR: forbid java.lang.String deprecated constructors #KT-51364 Fixed 2022-03-21 13:58:13 +00:00
Mikhail Glukhikh 05d65275bf FIR u/s scope: choose most specific intersection member for override check
Before this commit we took just first intersection member for this check.
However it's quite bad, because we were dependent on supertype order.
Choosing the most specific member looks more consistent here.

#KT-50969 Fixed
2022-01-31 21:59:18 +03:00
Mikhail Glukhikh 1137e61fc8 FIR: add test for KT-50969 2022-01-31 21:59:15 +03:00
Mikhail Glukhikh 98cdc95cd0 FIR DFA: exit delegate expression only after accessor completion
This commit fixes DFA problem (see test) when we accidentally try
to merge incoming flows from member property (val ... by cached ...) and
the following function. While completing lambda of buildList { ... }
inside by cached we accidentally assume that delegate is already left
and add the lambda into exitsFromCompletedPostponedAnonymousFunction.
This commit fixes the problem by exiting delegate later, after completion.
2022-01-20 23:46:39 +03:00
Mikhail Glukhikh 1938438fa1 FIR: save/restore tower data contexts during resolve jumps
#KT-50278 Fixed
2021-12-21 10:45:36 +00:00
Mikhail Glukhikh 25f30cb3a9 FIR: add resolve test for potential local scope problems 2021-12-21 10:45:34 +00:00
Simon Ogorodnik b45b624945 FIR: Fix integrating DeclaredUpperBound positions in builder inference 2021-12-15 22:23:01 +03:00
Mikhail Glukhikh df50a8141f FirCallCompleter: unwrap definitely not-null type properly
#KT-50180 Fixed
2021-12-13 16:24:59 +03:00