Commit Graph

47762 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 e4537cb9f0 [FIR2IR] Unify utilities for rethrowing exceptions with attachments 2024-02-28 08:28:14 +00:00
Dmitriy Novozhilov 88206ca151 [Util] Allow to use Throwable as cause of ExceptionWithAttachment 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 62e9c944fe [FIR2IR] Minor. Cleanup Fir2IrVisitor.convertToIrReceiverExpression 2024-02-28 08:28:12 +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
Marco Pennekamp 708ed81eb2 [Test] Avoid importing unused @Nested annotations in generated tests
- Unused `Nested` imports frequently cause unused import warnings in the
  IDE, which are especially annoying in after-commit warning/error
  analysis.
2024-02-27 20:30:06 +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
Vladimir Sukharev a582bf22e3 [JS] Try remove ScriptRemoveReceiverLowering
^KT-64958
2024-02-27 19:10:03 +00:00
Ivan Kylchik 6ec75a705e [IR] Store original function in the IrInlinedBlock
In Native and JS, there is a special logic where the compiler saves
a copy of inlined function (see `InlineFunctionsSupport`). This copy
is used in the IR inliner. Because of that, we can't really compare
inlined function with other functions directly. We need to
get `originalFunction` first and save it.
2024-02-27 17:41:33 +00:00
Artem Kobzar 800704a130 [K/JS] Allow private constructors inside external declarations ^KT-65964 Fixed 2024-02-27 16:51:07 +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
Dmitriy Dolovov f204293e4d [Test] Unify work with KLIB artifact paths and dependencies
Unify functions from `JsEnvironmentConfigurator` and
`WasmEnvironmentConfigurator` that do the same logic. Make this logic
also be available for `NativeEnvironmentConfigurator`:
- get*ArtifactSimpleName()
- get*KlibArtifactPath()
- get*KlibOutputDir()
- getAllRecursiveLibrariesFor()
- getAllRecursiveDependenciesFor()
- getAllDependenciesMappingFor()
- getKlibDependencies()

This would allow to have the same logic in one place, and also
reuse it in `IrBackendFacade`s to be implemented for Native.

^KT-65117
2024-02-27 15:22:47 +00:00
Andrei Tyrin 4e10dcd808 [tests] Klib based signature clash improve coverage for KT-63670 2024-02-27 14:01:44 +00:00
Alexander.Likhachev 95fd91ae16 [CLI, Gradle] Update GradleDeprecatedOption.removeAfter values
The values updated to follow the deprecation cycle "warning -> error -> removed"
^KT-65986 In Progress
2024-02-27 13:07:18 +00:00
Alexander.Likhachev d20f31e963 [CLI, Gradle] Fix GradleDeprecatedOption.removeAfter processing
The expected format was Kotlin language version (e.g. `2.0`), however the actual passed values were Kotlin release versions (e.g. `2.0.0`)
^KT-65986 In Progress
2024-02-27 13:07:18 +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
Nataliya.Valtman 5885514c3d Add JSON output type for build reports
#KT-65792 Fixed
2024-02-27 08:32:36 +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
Marco Pennekamp ea2bb32bc0 [PSI] Don't calculate ClassIds for local classes in call elements
- The fix uses relevant logic from  `getNonLocalContainingDeclaration`.
- The annotation entry case is covered by `KtCallElement` because
  `KtAnnotationEntry` is a subtype of it.
- KT-66038 is fixed by this because the static declaration provider only
  indexes non-local classes.

^KT-66038 fixed
2024-02-26 16:36:00 +00:00
Dmitriy Dolovov 4b4c5c4e6b [FIR] Serialization to KLIB: Clean-up in firKlibSerialization.kt 2024-02-26 16:07:10 +00:00
Dmitriy Dolovov 5a8330ebad [FIR] Serialization to KLIB: Don't sort classes
^KT-62135
2024-02-26 16:07:10 +00:00
Dmitriy Dolovov 4b0ac63c38 [FIR] Serialization to KLIB: Drop obsolete TODO comments 2024-02-26 16:07:10 +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
Yan Zhulanow 1c1da6bced [Analysis API] Cause OOB when imports change in code fragments
In K1, code fragment analysis was completely invalidated on any PSI
change. Because imports are not a part of the PSI tree of
'KtCodeFragment's, a colon tremble happened on 'addImportsFromString()'.

In K2, changes inside code fragments are always considered in-body
modifications. So, even with the colon trembling, the 'FirFile',
together with its 'FirImport's was not recreated.

^KT-65600 Fixed
2024-02-26 11:28:56 +00:00
Yan Zhulanow 45c0fa8d23 [PSI] Refactor import handling in code fragments
Now there is a single place that performs import modification, as well
as reports events related to that modification.
2024-02-26 11:28:55 +00:00
Pavel Kirpichenkov 00faa6fa01 [Tests] Support language features from test data in .knm meta compiler
Mute test failure revealed by unblocked context receivers (KTIJ-28885)

KTIJ-28668
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov ae664d37ae [Tests] Support KLIB metadata for stdlib in test compile utility
Create dependency provider able to resolve code from .knm metadata
files to simplify migration from the legacy kotlin-stdlib-common
artifact.

KTIJ-28668
KTI-1457
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 9373437cad [Tests] Add kotlin-stdlib dependency in KLIB metadata compile utility
It's necessary, for instance, to compile custom contracts in common

KTIJ-28668
KTIJ-26788
2024-02-26 10:18:38 +00:00
Pavel Kirpichenkov 3e5065fbba [Tests] Report compilation errors from test KLIB compiler
KTIJ-28668
2024-02-26 10:18:38 +00:00
Nikolay Lunyak 3b2bc598b5 [FIR] Reuse getNonSubsumedNonPhantomOverriddenSymbols
Just a small refactoring to avoid
duplicating comments.
2024-02-26 10:06:26 +00:00
Nikolay Lunyak 22fc90e5a1 [FIR] Treat properties from ObjC-classes as abstract
In short, the problem is some
platform libraries contain invalid
Kotlin code. Specifically,
some classes may inherit multiple
members with default
implementations, but do not define
an explicit override, like `UIView.bounds`.

Since we can't refactor platrofm
libraries just now, we want to
treat such properties as abstract.

^KT-65866 Fixed
^KT-65855
2024-02-26 10:06:26 +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
Dmitriy Novozhilov eb85caedad [FIR] Search for typealias in dependencies, if expect class was found first
^KT-65840 Fixed
2024-02-26 09:25:57 +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 Bobko 4c602585b0 [FIR, IR] Cleanup: drop unused allowClassActualizationWithWiderVisibility & allowTransitiveSupertypesActualization
These flags were used when ExpectActualMatchingContext was reused in K1.
2024-02-25 18:18:55 +00:00