Commit Graph

106295 Commits

Author SHA1 Message Date
Kirill Rakhman 49e786f088 [FIR] Copy java enum entry during enhancement instead of mutating it
#KT-57949 Fixed
2023-11-20 15:21:49 +00:00
Evgeniy.Zhelenskiy f5168527ae [FIR] Report type-parameterized implicit invoke call over type-parameterized property access
^KT-59988
2023-11-20 14:59:06 +00:00
Evgeniy.Zhelenskiy 86c09a1c78 [FIR] Report recursive typealias when loop is in type annotations
^KT-59908
2023-11-20 14:39:47 +00:00
Svyatoslav Kuzmich 31560217f8 [Wasm] Port @JsFun checker to K2 (KT-56849)
^KT-62724 Fixed
2023-11-20 14:39:24 +00:00
Vyacheslav Gerasimov fbc35975ab Build: Fix kotlinx-serialization-compiler-plugin compat artifacts
To avoid adding unexpected files we should add single file into
artifacts instead of directory.
 #KTI-1394
2023-11-20 14:37:54 +00:00
Dmitrii Gridin ea8a645513 [LL FIR] FirLazyBodiesCalculator: do not touch declarations during file annotation calculation
It leads to many problems in concurrent case.
E.g., we can transform the status of a declaration without the lock

^KT-62947 Fixed
2023-11-20 13:41:30 +00:00
Dmitriy Dolovov 6de0b3a645 [Gradle][MPP] Minor: Don't use @GradleTestVersions in the test
^KT-62515
2023-11-20 13:40:54 +00:00
Dmitriy Novozhilov 48141fbc2c [FIR2IR] Minor: remove unused function 2023-11-20 13:36:28 +00:00
Dmitriy Novozhilov 89b98ef784 [FIR2IR] Properly create FIR f/o for lazy IR f/o
```kotlin
interface A {
    fun foo() // (1)
}

interface B : A {
    // f/o fun foo() // (2)
}
```

In previous commits it was forgotten to create new FIR declarations for
  IR fake-overrides, which led to the situation when `IR lazy functions
  of `(1)` and `(2)` both contained fir of function (1) as their base
  declaration

It seems this change fixed some cases from KT-42020
2023-11-20 13:36:28 +00:00
Dmitriy Novozhilov 8ebb412705 [FIR2IR] Introduce special FirProvider with plugin-generated files
For declarations generated by plugins, fir2ir creates special synthetic
  FIR files, which are not registered in the regular FirProvider. This
  leads to incorrect determination of ir parent for generated declarations,
  because `irParent` utility relies on file returned from fir provider

To fix this issue, the new FirProvider for fir2ir is introduced, which
  wraps the original provider and allows to register newly created files

Note that this means that it's illegal anymore to use FirProvider from
  session anywhere in fir2ir. `firProvider` from `Fir2IrComponents`
  should be used instead
2023-11-20 13:36:28 +00:00
Dmitriy Novozhilov d85d671b26 [FIR] Update few MPP diagnostic tests
Updated tests contain errors which are incompatible with fir2ir conversion
  (like `PACKAGE_OR_CLASSIFIER_REDECLARATION` and `EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE`),
  so running fir2ir on such code may lead to exceptions
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 3dff232710 [FIR2IR] Generate IR for unbound symbols in allowNonCachedDeclarations mode
`allowNonCachedDeclarations` mode allows referring source declaration which
  does not belong to the set of sources passed to fir2ir (e.g. for debugger
  support). So if code refers to such declaration, fir2ir creates symbol
  for it but not the IR declaration itself
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov c9ff0c41fc [FIR2IR] Generate IR for f/o of common classes generated during platform conversion
This change fixes tests which were muted in one of previous commits
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 65797e8fba [FIR2IR] Don't create IR constructors when their symbol is referenced
KT-62856
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 55f62834cb [FIR2IR] Replace getOrCreateIrScript with createIrScript
Fir2IrDeclarationStorage should not sometimes create IR declarations
  during lookup requests
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 7263edf322 [FIR2IR] Split getOrCreateIrAnonymousInitializer method into two parts
Fir2IrDeclarationStorage should not sometimes create IR declarations
  during lookup requests
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 736201da1d [FIR2IR] Don't create IR properties when their symbol is referenced
KT-62856
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov f0f8a9728e [FIR2IR] Make parent of lazy declaration non-lateinit
There is no actual sense to have parent as a lateinit var, because in
  all places it is initialized right after declaration creation
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov bb892f10f8 [Test] Mute tests with expect supertypes
The problem: someone should generate IR for f/o in common classes appeared
  after IR actualization

Those tests will be fixed in the following commits
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov ca32722b0a [FIR2IR] Consider expectness of containing class in FakeOverrideIdentifier
```kotlin
// MODULE: a

interface Base {
    fun foo()
}

expect interface Derived : Base {
    // f/o fun foo() // (1)
}

// MODULE: b()()(a)

actual interface Derived : Base {
    // f/o fun foo() // (2)
}
```

Before this change `FakeOverrideIdentifier` for (1) and (2) were the same,
  which led to the problem when referencing (2) in `b` module returned symbol (1)
This behavior affected two places:
1. Referencing function symbol in some call. Here it wasn't an issue,
  because IrActualizer changed reference to (2) anyway
2. Creation of IR declaration for (2) in `FakeOverrideGenerator.createFakeOverriddenIfNeeded`.
  Previously it worked because of the following hack at `FakeOverrideGenerator:283-286`
```
takeIf { it.ownerIfBound()?.parent == irClass }
```
Generator referenced symbol (1), checked the parent and refused it, because
  its parent was different from `actual interface Derived`. Then it called
  declaration storage to create new IR declaration for (2), which unconditionally
  created new symbol for (2). But after previous commit logic of creation
  new declarations was changed: declaration storage extract potentially
  unbound symbol from cache and then creates a new declaration with this symbol.
  But cache still contains symbol (1) for given FakeOverrideIdentifier,
  which leads to the problem that we try to create new IR declaration
  for already bound symbol

To fix it and be able to distinguish f/o ids for (1) and (2) additional
  flag is added to FakeOverrideIdentifier, which shows if containing class
  of corresponding f/o is expect or not
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov e3a22791ff [FIR2IR] Don't create IR functions when their symbol is referenced
KT-62856
2023-11-20 13:36:27 +00:00
Dmitriy Novozhilov 547d6066a9 [FIR2IR] Change API of local storages to work with symbols instead of IR elements 2023-11-20 13:36:27 +00:00
Ivan Kylchik bedac19b99 [JVM] Rewrite isCallInsideSameModuleAsCallee
Try to use `IrModuleFragment` instead of `ModuleDescriptor`. This change
is required for the evaluate expression in IDE. When we compile
some code fragment with inline function call that has an anonymous
object in callee, we will get incorrect behavior. Code fragment is
wrapped in `EvaluatorModuleDescriptor` and we accidentally
think that inline call and callee are in different modules that
leads to an error in `AnonymousObjectTransformer.doTransform`.

#KT-63454 Fixed
2023-11-20 10:46:36 +00:00
Mikhail Glukhikh 5cd3f8bb97 K2: don't report inline access errors on const properties in annotations
#KT-60604 Fixed
2023-11-20 10:32:05 +00:00
Mikhail Glukhikh bb8002d9f1 K2: reproduce KT-60604 2023-11-20 10:32:05 +00:00
Ilya Goncharov 94ce4c06a7 [Gradle, Wasm] Use separate hierarchical methods for JS and wasi
^KT-63417 fixed
2023-11-20 10:30:58 +00:00
Ilya Goncharov dcab981ee8 [Gradle, Wasm] Use static source sets accessors for wasm
^KT-62955 fixed
2023-11-20 10:30:16 +00:00
Yahor Berdnikau 0c30acfba6 [repo] fix '.kotlin' directory entry in '.gitignore'
After KT-58223 implemetation KGP started to store project persistent
data inside '.kotlin' directories.
2023-11-20 09:00:11 +00:00
Pavel Kunyavskiy b38ebbb853 [IR] Avoid ir.actualization depending on frontend module
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy 021a00f4ff [IR] Avoid depending from fir2ir on ir.actualization module
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy cf6792ec65 [IR] Optimize dependencies of ir.actualization module
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy 55e7ff18c6 [IR] Extract IrActualizationErrors from CommonBackendErrors
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy 763d2ec2fe [IR] Move IrGetValue.actualize() to IrUtils and rename it
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy e80d4b1d60 [IR] Move IrDeclaration.isExpect to IrUtils
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy 41098a2e34 [IR] Extract IrDiagnosticReporter interface
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy faaefbd8e7 [IR] Move .parents and .parentsWithSelf to IR utils
^KT-62292
2023-11-20 08:31:41 +00:00
Pavel Kunyavskiy 649a7bd66b [IR] Moved actualizer and related things to separate module
^KT-62292
2023-11-20 08:31:41 +00:00
Ilya Gorbunov 62700c3ec3 [stdlib] K/N ArrayList: restore constructor docs, correct modifier order 2023-11-20 02:24:40 +00:00
Ilya Gorbunov aa4419b7e3 [stdlib] Explicit visibility and return types: Collections 2023-11-20 02:24:40 +00:00
Ilya Gorbunov 0dd61c9f81 [stdlib] Explicit visibility and return types: Duration 2023-11-20 02:24:40 +00:00
Ilya Gorbunov da1d3be7f2 [stdlib] Explicit visibility and return types: StringBuilder 2023-11-20 02:24:40 +00:00
Ilya Gorbunov 92b3131c12 [stdlib] Explicit visibility and return types: HexFormat 2023-11-20 02:24:40 +00:00
Ilya Gorbunov 02e933b3ff [stdlib] Explicit visibility and return types: common 2023-11-20 02:24:39 +00:00
cristiangarcia 7a267afeae Assert build.number is present if deployVersion is
KTI-1454 Fail instead of producing the wrong artifacts
2023-11-18 21:25:55 +00:00
Artem Kobzar 1832f5a3f7 [K/JS] Introduce the ability to consume platform-specific cli arguments inside the main function ^KT-16981 Fixed 2023-11-18 11:01:34 +00:00
Mikhail Glukhikh ceded87a3a K2: add more comments to subsequent visibility checks
Related to KT-63164
2023-11-17 20:29:58 +00:00
Mikhail Glukhikh ec7caba8ea K2: restore smart cast in case with invisible receiver but visible callable
Related to KT-52432
#KT-63164 Fixed
2023-11-17 20:29:58 +00:00
Mikhail Glukhikh a139965231 K2: reproduce KT-63164 2023-11-17 20:29:58 +00:00
Marco Pennekamp 271f83d07d [LL] Disable declaration modification service tests temporarily
- We cannot configure write access using the application environment
  creation because application environments are cached between test
  runs.

^KT-63560
2023-11-17 18:09:55 +00:00
Ilya Gorbunov 23e0e40acc Create a copy of shared code for building JVM part of native interop runtime
This is required because IDEA cannot import the same directory in multiple modules.
2023-11-17 17:30:58 +00:00