Commit Graph

84 Commits

Author SHA1 Message Date
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
Tianyu Geng 765cad8448 FIR checker: substitute type parameters in dispatch receiver type
Consider the following code:

```
fun test(a: List<String>) {
  a.first()
}
```

The dispatch receiver type of `first` in this case is `List<T>` before
this change. After this change, it's `List<String>`.

In addition, this change also replace the dispatch receiver type with
the more specific type if available. For example, consider the following

```
class MyList: ArrayList<String>()

fun test(a: MyList) {
  a.get(0)
}
```
The dispatch receiver type of `get` is `MyList`, instead of
`ArrayList<String>`. That is, a fake override is created in this case.
2021-09-17 01:59:06 +03:00
Mikhail Glukhikh 3febabe977 Use OPT_IN instead of EXPERIMENTAL in diagnostic names 2021-09-10 16:29:13 +03:00
Denis.Zharkov 112af9b145 FIR: Rework bare types support
^KT-48305 Fixed
2021-08-30 16:24:44 +03:00
Dmitriy Novozhilov 0924216ed2 [FIR] Distinguish stub types for builder inference and for subtyping
^KT-48110 Fixed
2021-08-26 10:08:52 +03:00
Mikhail Glukhikh 82f268d611 FIR: add EXPERIMENTAL_API_USAGE reporting 2021-07-23 23:58:55 +03:00
Dmitriy Novozhilov f400477c70 [FIR] Remove generic parameter from FirDeclaration 2021-06-29 21:03:30 +03:00
Igor Yakovlev 30c381f16d [FIR] Fix invalid CallableId for methods in anonymous objects 2021-06-28 17:21:42 +03:00
Ivan Kochurkin 66e2b44272 [FIR] Implement UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION diagnostics, fix handling of UPPER_BOUND_VIOLATED 2021-06-25 20:57:46 +03:00
Ilya Kirillov 72b8593240 FIR IDE: do not use IJ test infrastructure in frontend-api-fir tests 2021-06-20 22:07:31 +02:00
Igor Yakovlev ec80c21fd1 [FIR IDE] Fix lazy resolve for local declarations 2021-06-19 19:23:24 +02:00
Denis.Zharkov 592256976e FIR: Fix inference of builder-inference function from expect type
Previously, such calls were being completed with FULL mode and incorrect
INFERENCE_NO_INFORMATION_FOR_PARAMETER has been reported
2021-06-07 15:25:57 +03:00
Ivan Kochurkin c4c2fbb5a0 [FIR] Implement RECURSIVE_TYPEALIAS_EXPANSION, CYCLIC_INHERITANCE_HIERARCHY diagnostics, fix stackoverlow exception in case if typealias points to type with type arguments 2021-06-03 20:41:58 +03:00