48203 Commits

Author SHA1 Message Date
Iaroslav Postovalov 9a2e4c6b41 [Tests] FIR support in JUnit 3 tests, port necessary subclasses
^KT-64404 Fixed
^KT-64438 Fixed
^KT-64407 Fixed
2024-03-19 17:56:29 +00:00
Kirill Rakhman e69d6d2d05 [FIR/JS] Fix package name check in FirJsPackageDirectiveChecker
#KT-66491 Fixed
2024-03-19 17:06:35 +00:00
Alexander Udalov 621fe41b17 JVM: restore incorrect DFS logic in JavaModuleGraph for compatibility
The problem is tracked in KT-66622. It should be fixed later, with a
proper deprecation, because otherwise it can potentially break a lot of
code.
2024-03-19 15:51:01 +00:00
Alexander Udalov 94e5cafb61 JVM: fix "module reads" check in JavaModuleGraph
There was a bug in the DFS. Whenever we encountered a "requires
transitive X" directive in some module, we recursively invoked DFS not
on X but on `dependencyName`, which is the target module that we're
trying to find the path to. And that always failed, because no module
requires itself.

 #KT-66275 Fixed
2024-03-19 15:51:01 +00:00
Ilya Chernikov fecc5ba501 K2: do not try to resolve invoke on error receiver
If a potential receiver is resolved to an error type, we consider
any other type as a subtype of it and therefore may select
any candidate that we happen to find in a scope.
In particular, in the case of scripts, or code with a context receiver,
the receiver candidate resolved to a cycle was accepted as a receiver
to an invoke on a random class from stdlib.
The fix skips adding invoke resolve task in this case, allowing
the tower to find the correct candidate in another scope.

#KT-64241 fixed
#KT-65576 fixed
2024-03-19 15:38:35 +00:00
Ilya Chernikov d5ad41fa28 K2 Scripting: add failing test for #KT-64241 2024-03-19 15:38:35 +00:00
Kirill Rakhman 988edab7a0 [Tests] Add regression test for #KT-58575
#KT-58575 Fixed
2024-03-19 15:34:43 +00:00
Dmitrii Gridin a0120d28cc [FIR] FirResolvePhase: introduce isItAllowedToCallLazyResolveToTheSamePhase
To have explicitly declared contracts
2024-03-19 14:53:28 +00:00
Dmitrii Gridin c7765258d1 [FIR] FirResolvePhase: introduce isItAllowedToCallLazyResolveTo
To explicitly declare when it is possible to call lazy resolve
2024-03-19 14:53:28 +00:00
Johan Bay 32d67d101a [K/N] add flag to klib manifest for header klibs
^KT-65443
2024-03-19 14:09:44 +00:00
Johan Bay b50111cde5 [K/N] add testing setup for header klibs and caches
^KT-65443
2024-03-19 14:09:44 +00:00
Dmitrii Gridin 2fbde7a85c [Analysis API] reuse PsiClassRenderer for PsiType render
To align the format with light classes as now we are powered by them

^KT-66603
2024-03-19 13:57:23 +00:00
Dmitrii Gridin 54aee57fec [LC] preserve type annotations from wildcard bound
^KT-66603
2024-03-19 13:57:23 +00:00
Dmitrii Gridin 96575a0bdb [Analysis API FIR] preserve type annotations on asPsiType conversion
^KT-66603 Fixed
2024-03-19 13:57:23 +00:00
Dmitrii Gridin 3c8a95e623 [LC] render all type annotations in tests
^KT-66603
2024-03-19 13:57:23 +00:00
Dmitrii Gridin 66d1839d20 [LC] add tests on nested type annotations
^KT-66603
2024-03-19 13:57:23 +00:00
Kirill Rakhman 72235b8527 [FIR] Report INNER_CLASS_CONSTRUCTOR_NO_RECEIVER on delegated constructor calls
#KT-59677 Fixed
2024-03-19 12:51:06 +00:00
Stanislav Ruban e9d5396fa9 [FIR][checkers] Handle ConeHiddenCandidateError in FirDestructuringDeclarationChecker properly
#KT-66595 Fixed
2024-03-19 12:32:17 +00:00
Stanislav Ruban 89a0cde514 [tests][FIR][checkers] Add test data for KT-66595 2024-03-19 12:32:17 +00:00
Alexander Udalov 8ad38db2ad JVM IR: do not use JvmMethodParameterKind 2024-03-19 11:12:31 +00:00
Alexander Udalov d9bc714992 JVM IR: remove usages of JvmMethodParameterKind.RECEIVER/CONTEXT_RECEIVER
Also slightly refactor ExpressionCodegen.visitCall.
2024-03-19 11:12:31 +00:00
Ilya Chernikov 0df3a37303 K2 Scripting, Fir2Ir: allow out of order supertypes declaration
fix script declarations registration logic in Fir2Ir to allow
supertypes of a class to be defined later than the class itself.

#KT-64534 fixed
2024-03-19 08:24:17 +00:00
Dmitriy Novozhilov f18aa5e70f [Test] Add regression test for KT-66638 2024-03-19 07:40:09 +00:00
Marco Pennekamp a9d7b0c595 [AA Standalone] Consider type aliases in direct inheritors search
A type alias may still be inherited from. For example:

```
sealed class MyClass

typealias T = MyClass

class Inheritor : T() // `Inheritor` is a direct inheritor of `MyClass`.
```

The index is a simplified version of the IDE's
`KotlinTypeAliasByExpansionShortNameIndex`, but it should be sufficient
for virtually all cases.

^KT-66013
2024-03-18 21:14:36 +00:00
Mikhail Glukhikh 3fbb7bc920 K2: report MISSING_DEPENDENCY_CLASS in case of error type of expression
This commit is intended to get a more clear diagnostic in case when
the type checker creates an inconsistent error type due to some
classifier inaccessibility. Before this commit, we reported simply
ARGUMENT_TYPE_MISMATCH (see test). Now we report also
MISSING_DEPENDENCY_CLASS by analyzing an error type of a qualified
expression.

#KT-66356 Fixed
2024-03-18 18:11:14 +00:00
Mikhail Glukhikh 2d755aabe7 K1/K2: add test data for KT-66356 2024-03-18 18:11:14 +00:00
Stanislav Ruban 29efe8645c [FIR][checkers][JS] Expand type aliases to supertypes in FirJsInheritanceClassChecker
#KT-66673 Fixed
2024-03-18 15:57:59 +00:00
Stanislav Ruban 1f3d318cae [tests][FIR][checkers][JS] Add test data for KT-66673 2024-03-18 15:57:59 +00:00
Kirill Rakhman 672512d19d [FE] Skip CST computation if list of types has exactly one entry
Otherwise, we can get in a situation where the single item is flexible,
and we replace its attributes with the attribute of the lower bound,
which messes up `EnhancedTypeForWarningAttribute`.

#KT-65193 Fixed
2024-03-18 15:52:50 +00:00
Kirill Rakhman 19cc739118 [Tests] Reproduce #KT-65193 2024-03-18 15:52:50 +00:00
Wojciech Litewka 6af930fc0e Partially revert "[IR] Hide constructors of implementation classes behind factory functions"
To restore binary compatibility with a compiler plugin used in
one of user projects.

#KT-66636 Fixed
2024-03-18 12:17:52 +00:00
Sebastian Sellmair 6d8a4a28af [FIR] Deserialize Klib KlibMetadataProtoBuf. classFile, functionFile & propertyFile
klibs provide information about the container source file
in the KlibMetadataProtoBuf extensions for functions,
properties and classes.

This information is deserialized and attached to the
`klibSourceFile` extension (stored in FirDeclarationDataRegistry)

^KT-66271 Fixed
2024-03-18 10:13:57 +00:00
Kirill Rakhman 85a1d67d19 [FIR] Fix giant type produced by CST
#KT-65704 Fixed
2024-03-18 08:41:26 +00:00
Kirill Rakhman 81c0ee471f [Tests] Reproduce #KT-65704 2024-03-18 08:41:26 +00:00
Vladimir Sukharev e03af07a1c [Tests] Revive KlibEvolutionTests
Allows CI testing for KT-44602, KT-44604, KT-44598, KT-44599, KT-66342

^KT-44602
2024-03-16 07:50:33 +00:00
Dmitriy Dolovov 722acc028a Revert "[K/N] add testing setup for header klibs and caches"
This reverts commit a89893a2c5.
2024-03-15 22:32:50 +01:00
Dmitriy Dolovov a78d498e36 Revert "[K/N] add flag to klib manifest for header klibs"
This reverts commit 59f0c0464b.
2024-03-15 22:32:50 +01:00
Stanislav Ruban a781a08386 [tests] Fix KMP test data affected by 9d566465
Affected test data was in a correct state in the corresponding MR branch, but that state was invalidated by the appearance of 9d566465 in the master branch. Because the MR branch in question was created and checked via CI runs before 9d566465 was committed to master, the discrepancy couldn't be caught by MR quality gates.
2024-03-15 17:00:03 +00:00
Sergej Jaskiewicz 1476b89ea3 [build] Forward the JDK_21_0 environment variable to tests 2024-03-15 15:07:13 +00:00
Alexander Udalov 5cbaf077f3 JVM: remove FilteredJvmDiagnostics
The purpose of this class was to avoid reporting conflicting JVM
signatures / accidental override errors when there's a similar (e.g.
conflicting overloads) diagnostic already reported.

It was not used meaningfully because it only affected diagnostics
reported by the old JVM backend. Also, in real life, backend diagnostics
would not be reported anyway in most cases because backend is not even
run if there's an error after frontend.
2024-03-15 14:39:56 +00:00
Alexander Udalov b4d65fe5cd JVM: remove obsolete code for reporting JVM backend diagnostics
The last remaining usages from diagnostic tests were removed in previous
commits.
2024-03-15 14:39:56 +00:00
Alexander Udalov 32c8664f71 Tests: remove JVM diagnostics from AbstractDiagnosticsTest
There's no behavior specific for JVM backend diagnostics in any of the
affected tests, and this code is using an incorrect way to obtain those
diagnostics, so it should be removed anyway.
2024-03-15 14:39:56 +00:00
Alexander Udalov 88d159ec65 IR: minor, update the comment about K2 kapt in IrGenerationExtension
K2 kapt does use stub generation in the end after all, but using the
analysis API instead of the IR backend.
2024-03-15 14:32:39 +00:00
Alejandro Serrano Mena a18dca5728 Add missing cases for PROPERTY_AS_OPERATOR 2024-03-15 12:52:10 +00:00
Kirill Rakhman 2095f90e69 [FIR] Fix exception in Java scope caused by inherited member with implicit return type
It's caused by checking the return type of an inherited property.
toConeKotlinTypeProbablyFlexible() returns an error type when the
type ref is unresolved instead of throwing.
This "breaks" some override checks and in the added test, it leads
to an additional candidate being created for a synthetic property.
However, the candidate has applicability K2_SYNTHETIC_RESOLVED
and gets filtered out because the real property has a higher
applicability.

#KT-66392 Fixed
2024-03-15 12:01:55 +00:00
Stanislav Ruban 8f420eb3e1 [FIR][checkers][Wasm] Turn FirWasmJsInteropTypesChecker into a platform checker
#KT-66475 Fixed
2024-03-15 11:40:55 +00:00
Stanislav Ruban 478c1a6d50 [FIR][checkers][JS] Move reporting of FirJsErrors.EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE to FirJsInheritanceClassChecker
#KT-66474 Fixed
2024-03-15 11:40:55 +00:00
Stanislav Ruban 0549c6c75b [FIR][checkers][Wasm] Expand type aliases in FirWasmExternalInheritanceChecker
#KT-66473 Fixed
2024-03-15 11:40:55 +00:00
Stanislav Ruban 4d17a908e2 [tests][FIR][checkers][Wasm] Add test data for KT-66475 2024-03-15 11:40:55 +00:00
Stanislav Ruban bf77cc3d0c [tests][FIR][checkers][JS] Add test data for KT-66474 2024-03-15 11:40:55 +00:00