Commit Graph

19294 Commits

Author SHA1 Message Date
Dmitriy Novozhilov dd94de3a34 [FIR2IR] Properly set statement origin for all parts of += calls
^KT-65649 Fixed
2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov 5c632bc78e [FIR2IR] Don't create f/o symbols on smartcasted Nothing in dispatch receiver
^KT-63525 Fixed
2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov 5b01396a11 [FIR] Carefully process constructors of inner and nested classes in the tower
If there is an expression receiver, we should process constructors only
  of inner classes. Constructors of nested classes can be called only
  on classifier

^KT-65333 Fixed
2024-02-28 08:08:32 +00:00
Dmitriy Novozhilov 67557ce731 [Test] Reproduce KT-65333 2024-02-28 08:08:31 +00:00
Abduqodiri Qurbonzoda 557ea32f87 Introduce kotlin.AutoCloseable typealias in K/JVM stdlib #KT-55777 2024-02-27 20:52:49 +00:00
Artem Kobzar 02a78051aa [PSI2IR] Sync start and end offsets on PSI and FIR for an implicit return inside lambdas 2024-02-27 19:25:24 +00:00
Artem Kobzar 3429cbd321 [K/JS] Support companion objects in external and exported declarations 2024-02-27 16:30:13 +00:00
Alexander Udalov 5cda3fba12 IR: produce new fake override for each static member
This is an addition to d4278250e6. Apparently we still need to produce
a new fake override for each inherited static member, because otherwise
we would try to determine the most specific return type, maximum
visibility, etc, all of which makes no sense for static members.

 #KT-66152 Fixed
2024-02-27 16:05:52 +00:00
Andrei Tyrin 4e10dcd808 [tests] Klib based signature clash improve coverage for KT-63670 2024-02-27 14:01:44 +00:00
Roman Efremov 23ae617ea0 Fix inaccurate report of DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM
Add separate diagnostic for the case when it is reported on qualifiers.

^KT-64488
2024-02-27 11:22:35 +00:00
Roman Efremov 02b5fed389 Fix inaccurate report of DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM
It can be reported not only from within the enum, but also from
top-level functions. Add separate diagnostic for such cases.

^KT-64488
2024-02-27 11:22:35 +00:00
Roman Efremov 34d87465ac [Test] Add test for Enum.entries shadowing when property is imported
This is similar to KT-64488 but without context receivers.
Warning message "access ... from within the enum" is also incorrect
here.

^KT-64488
2024-02-27 11:22:35 +00:00
Mikhail Glukhikh 678816f9e8 K1: introduce BUILDER_INFERENCE_STUB_PARAMETER_TYPE to prevent compiler crashes
This diagnostic is reported in rare situations when
StubTypeForBuilderInference is kept as a parameter type
of for loop or lambda. Before this commit, we had in K1
"Could not load module <error module>" from IrLinker instead.

Related to: KT-52757, KT-53109, KT-63841, KT-64066
#KT-53478 Fixed
2024-02-27 10:25:13 +00:00
Dmitriy Novozhilov 6f6e37f552 [FIR] Report about recursion in implicit types for receivers of invoke
^KT-65576 Fixed
2024-02-27 09:34:02 +00:00
Dmitriy Novozhilov 234cc5be2b [Test] Reproduce KT-65576 2024-02-27 09:34:02 +00:00
Mikhail Glukhikh 91e9fbd9bf K1: change depr. level of List.getFirst to HIDDEN but don't force it on overrides
#KT-65441 Fixed
2024-02-27 08:40:53 +00:00
Mikhail Glukhikh d870d9dcc6 K1/K2: add tests for KT-65441 current behavior 2024-02-27 08:40:52 +00:00
Alexander Udalov d4278250e6 IR: never check static members for overridability
#KT-66077 Fixed
2024-02-26 20:38:02 +00:00
Dmitriy Novozhilov 6a94a3331f [FIR] Don't create synthetic property if getter and property came from the same class
Usually we create synthetic property in java class if there is a property
  from the base kotlin class and getter/setter with a corresponding name
  in the declared scope or one of supertype scopes. But there is a case,
  where the same supertype contains both property and getter:
```
// FILE: Base.kt
open class Base {
    open val b = "O"

    @JvmName("getBJava")
    fun getB() : String = "K"
}

// FILE: Derived.java
public class Derived extends Base {}
```

In this case we shouldn't create synthetic property, because `getB()`
  function is invisible for `Derived` class

^KT-66020 Fixed
2024-02-26 17:44:30 +00:00
Vladimir Sukharev febac0dd5f [Tests] Migrate backend-independent tests from native to compiler/testData.
^KT-65979
2024-02-26 13:38:49 +00:00
Nikolay Lunyak f1c7f929d2 [FIR] Don't miss diagnostics on resovled reified type parameters
^KT-66005 Fixed
2024-02-26 09:53:13 +00:00
Nikolay Lunyak b0e6db7807 [FIR] Reproduce KT-66005
^KT-66005
2024-02-26 09:53:13 +00:00
Kirill Rakhman c3c2f6f90a [FIR] Don't set lambda parameter type to Nothing by default
... when the expected type is not a function type.
Instead set it to a new type variable.
This fixes a bunch of false negative CANNOT_INFER_PARAMETER_TYPE.

#KT-59882 Fixed
2024-02-26 08:59:22 +00:00
Dmitriy Novozhilov 9857bdc891 [FIR2IR] Unwrap typealiases during applying of suspend conversion
^KT-65002 Fixed
2024-02-26 08:56:24 +00:00
Nikita Bobko c31a72a4af [FIR] Switch FirExpectActualDeclarationChecker to Platform checker
^KT-66028 Fixed
2024-02-25 18:18:55 +00:00
Nikita Nazarov 407448d8e3 [JVM] Implement new inlined variable naming format
^KT-65478 fixed
2024-02-23 23:59:13 +01:00
Ilya Chernikov 9ea775cbed K2 scripting: fix containing decl for last script expression
Generally the wrapping anonymous initializer can be used as a
"containing declaration" for some elements, but since the initialiser
for the last script expression could be dropped (the expression could
be converted to the result property), this may lead to the surprises,
e.g. as described in KT-65984
This fix marks the last initialiser as local, preventing it from being
referenced as "containing declaration".

#KT-65984
2024-02-23 22:03:44 +00:00
Ilya Chernikov eab5164993 Scripting: fix script lowering in case of out of order declarations
The problem was that in K2 for some top-level script declarations we
need to add a dispatch receiver parameter (because frontend do not
assign any, but representing script as a class requires it to be the
script class) and at the same time, calls to these declarations rely on
properly set dispatch receiver parameter.
The simplest solution found is to have an additional traversal on the
relevan top-level declarations and assigning the dispatch receiver,
before running the main transformation.

#KT-64502 fixed
2024-02-23 22:03:44 +00:00
Pavel Kunyavskiy c991535756 [IRFakeOverrides] Fix accessors visibilities
^KT-65801
2024-02-23 16:35:27 +00:00
Dmitriy Novozhilov fb4b14e250 [FIR2IR] Part 4. Cleanup Fir2IrClassifierStorage API (enum entries)
^KT-65937 Fixed
2024-02-23 16:26:05 +00:00
Dmitriy Novozhilov 3bf0a11ced [Test] Reproduce KT-65937 2024-02-23 16:26:05 +00:00
Artem Kobzar be47632609 [K/JS] Optimize logical operators generating 2024-02-23 15:16:31 +00:00
Kirill Rakhman 4780bb90e7 [FIR] Fix mapping of java annotation arguments when parameter is array
#KT-65933 Fixed
2024-02-23 14:01:16 +00:00
Dmitriy Novozhilov 6479b15e46 [Test] Add regression test for KT-65493 2024-02-23 12:16:12 +00:00
Nikolay Lunyak 35b172c40f [FIR] Ensure KT-65581 is non-reproducible
It seems it was briefly introduced at
and then present at `2.0.0-dev-14408`,
but no longer is at `2.0.0-dev-16490`

^KT-65581 Obsolete
2024-02-23 11:52:13 +00:00
Ivan Kochurkin 1e388ad7dc [FIR2IR] Remove non-existent accessors from property references on Java fields
Rename `MissingFieldInJavaClass.kt` to `FieldsFromJavaClass.kt` to correspond its content

^KT-65722 Fixed
2024-02-23 11:22:44 +00:00
Alexander Udalov 555b35d894 Minor, add regression test for KT-62788 2024-02-23 09:02:03 +00:00
Ilya Gorbunov 86d5e83f4b [stdlib] Remove bootstrap implementation of enumEntriesIntrinsic
It should have been already implemented as intrinsic in all backends.

Do not test enumEntries intrinsic in the old JVM BE.

KT-53154

Co-authored-by: Alexander Udalov <alexander.udalov@jetbrains.com>
2024-02-23 05:50:37 +00:00
Nikita Bobko 7924573d20 [FIR] Report redeclaration across KMP source sets
^KT-57585 Fixed

Related tests:
- MultiPlatformIntegrationTestGenerated.testSimpleNoImplKeywordOnTopLevelFunction
- MultiPlatformIntegrationTestGenerated.testWeakIncompatibilityWithoutActualModifier
- FirPsiJsKlibDiagnosticsTestGenerated.testSignatureClash_MPP
- LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated$ResolveWithStdlib$MultiModule.testFakeOverrides
- DiagnosticCompilerTestFE10TestdataTestGenerated$Tests$Multiplatform:
- LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated$Tests$Multiplatform
- FirOldFrontendMPPDiagnosticsWithPsiTestGenerated
- FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated
- FirLibraryModuleDeclarationResolveTestGenerated.testDataClass
- org.jetbrains.kotlin.idea.k2.highlighting.K2HighlightingMetaInfoTestGenerated$Diagnostics.testDataClassFromLibrary
- org.jetbrains.fir.uast.test.FirLightClassBehaviorTest.testContainingFile
- org.jetbrains.fir.uast.test.FirLightClassBehaviorTest.testAnnotationParameterReference
- org.jetbrains.uast.test.kotlin.org.jetbrains.uast.test.kotlin.comparison.FE1LightClassBehaviorTest.testContainingFile
2024-02-22 16:06:36 +00:00
Dmitriy Novozhilov e431a96897 [FIR2IR] Properly calculate overridden functions for lazy fake overrides
For detailed explanation see the comment to `computeBaseSymbolsWithContainingClass`
  function in `FakeOverrideGenerator.kt`

^KT-65592
2024-02-22 15:56:57 +00:00
Vladimir Sukharev 1761c8eb25 [K/N][Tests] Ignore test sourceBinarySource.kt for per-file-caches on Linux
^KT-65669
2024-02-22 14:57:15 +00:00
Igor Yakovlev eea3c3624c [WasmJs] Generate a wrapper that run in Deno
Fixed #KT-65713
2024-02-22 14:45:09 +00:00
vladislav.grechko f32367d2c2 Fix IrFunction.isEmptyArray implementation
The previous one was incorrect for K1 since parent of top-level function
is `IrClass`, not `IrPackageFragment`.

The change is non-functional, K1 still worked correctly, but had to do
some extra work when inlining `emptyArray` calls and produces less
performant bytecode.
2024-02-22 07:32:36 +00:00
vladislav.grechko 224a4e1e3c Do not exclude codegen/box/script directory from JVM ABI tests 2024-02-22 07:32:35 +00:00
Nikolay Lunyak ae0d1201c5 [FIR] Add a blackbox test for failure #3 of KT-65972
^KT-65972
2024-02-21 20:24:18 +00:00
Nikolay Lunyak 01cff6b5e9 [FIR] Call distinctBy for containsMultipleNonSubsumed
Otherwise, when analyzing
`PsiTypeParameterListOwner` in the
related test, we (after flattening and
`nonSubsumed()`) get 2 `JvmMember.accept`
from the same very java enhancement
scope `JvmMember`.

^KT-65972
2024-02-21 20:24:17 +00:00
Nikolay Lunyak 453b97a2d1 [FIR] Reproduce one more failure for KT-65972 #3
^KT-65972
2024-02-21 20:24:17 +00:00
Nikolay Lunyak 39cbe3fb35 [FIR] Add a blackbox test for failure #2 of KT-65972
^KT-65972
2024-02-21 20:24:17 +00:00
Nikolay Lunyak 341a23d05c [FIR] Introduce containsMultipleNonSubsumed to intersection overrides
After this change the IO created for
`SimpleColoredComponent::setToolTipText`
will be `containsMultipleNonSubsumed == true`
while IOs created for classes in
`intersectionOverridesIntersection.kt`
will have this property set to `false`.

^KT-65972 Fixed
2024-02-21 20:24:16 +00:00
Nikolay Lunyak ee20d979cb [FIR] Reproduce one more failure for KT-65972 #2
And refactor another related test to
explain the desired behavior.

^KT-65972
2024-02-21 20:24:16 +00:00