Commit Graph

109603 Commits

Author SHA1 Message Date
Dmitrii Gridin 1ba81fca57 [Analysis API] add tests on incomplete function type parameter symbol
^KT-65858 Obsolete
2024-03-06 16:09:43 +00:00
Dmitrii Gridin ca740b70f3 [LL FIR] LLFirLazyResolver: inline updatePhaseForDeclarationInternals
This is the responsibility of `LLFirTargetResolver` to call it
2024-03-06 16:06:21 +00:00
Dmitrii Gridin 141b187e37 [LL FIR] encapsulate checkIsResolved for LLFirResolveTarget
In this way, only `LLFirLazyResolver` will be responsible for running
and checking the resolution result.
Also, this commit replaces redundant `checkIsResolved` for
`LLFirResolveTarget` with cheaper `checkIsResolved` for declarations.
2024-03-06 16:06:21 +00:00
Dmitrii Gridin c4bb5c6d8f [LL FIR] mark LLFirTargetResolver and LLFirLazyResolver as sealed as we know hierarchy 2024-03-06 16:06:21 +00:00
Dmitrii Gridin 4db10a1d94 [LL FIR] drop ability to enable global phase lock
Also, this commit adds the missing global lock for `IMPORTS` phase.

This commit doesn't change any logic for the case with disabled lock
(the default case), only updates the case with enabled lock.

^KT-66306 Fixed
2024-03-06 16:06:21 +00:00
Dmitrii Gridin 2229c82dc4 [LL FIR] additional checkCanceled after resolution
We have explicit cancellation checks between phases and inside locks,
so it is worth adding the check after `checkIsResolved`
2024-03-06 16:06:21 +00:00
Sergej Jaskiewicz 67afd12f94 [test] Remove redundant signature clash diagnotic test from Native tests
Since d8d8f24f62 the tests for this
diagnostic are run with the Compiler Core test infrastructure
(see `compiler/testData/diagnostics/klibSerializationTests`)
There is no need to test it separately in `FirCompilerOutputTest`.

^KT-64393 Fixed
2024-03-06 16:05:40 +00:00
Dmitrii Gridin 8c320f0602 [LL FIR] LLFirTargetResolver: add more debug info for containingClass
^KT-66132
2024-03-06 14:44:07 +00:00
Artem Olkov a26ffe360c KT-65907: add handling for nested classes #KT-65907 fixed 2024-03-06 14:40:17 +00:00
Pavel Punegov 8ef2d49ab0 [K/N][test] Refactor test results handling
Move handling to appropriate TestRunCheck instances to make
them separate from each other. Also this makes it possible to
use separately from the ResultHandler on specific scenarios like
in FrameworkTest.
2024-03-06 13:32:32 +00:00
Pavel Punegov 5ddfd4fd91 [K/N][test] Check test filtering with different run parameters
Adds additional checks when different test filtering is used, like
ignored tests filter.
This makes SharedExecutionBuilder be able to handle tests separately
but run together in the executable.
2024-03-06 13:32:32 +00:00
Pavel Punegov 8907885a75 [K/N][test] Refactor test run checking
Make test filtering matching be a check instead of the verification
code in ResultHandler. This allows turning it on/off for specific
test cases and have different checking strategies.
2024-03-06 13:32:32 +00:00
Artem Kobzar 77f0cba23f [K/JS] Introduce v2015 target 2024-03-06 12:21:38 +00:00
Dmitriy Novozhilov e989e6d397 [FIR] Don't compute getter return type if synthetic property is inapplicable
Return type computation of getter for synthetic property, which is
  incompatible anyway (e.g. because there is no java in the hierarchy)
  may cause excess dependency between return types of declarations, which
  may lead to recursive problems in resolution

^KT-66313 Fixed
2024-03-06 11:56:01 +00:00
Dmitriy Novozhilov fece081265 [Test] Reproduce KT-66313 2024-03-06 11:56:01 +00:00
Ivan Kylchik 5fe3fa878e [Test] Fix LL FIR test data after introducing new CONSTANT_EVALUATION phase
#KT-64151
2024-03-06 11:35:41 +00:00
Ivan Kylchik ada47eb110 [K2] Add new resolve phase CONSTANT_EVALUATION
During this phase, the compiler will evaluate initializers of
const properties and defaults of annotation's constructor.
Evaluation results will be stored in corresponding attributes.

#KT-64151
2024-03-06 11:35:41 +00:00
Ilya Goncharov b157a8eae5 [Wasm] Add wasm target to Klib manifest
^KT-66327 fixed
2024-03-06 10:57:50 +00:00
Mikhail Glukhikh 5ea6f20192 K1/K2: add reproducers for KT-66229, KT-66243 and KT-66272
As all these issues aren't reproducible in K2, we may count them as fixed.
Related to KT-53478
#KT-66229 Fixed
#KT-66243 Fixed
#KT-66272 Fixed
2024-03-06 09:01:38 +00:00
Dmitriy Novozhilov b43f69364b [IR] Forcefully collect mapping of f/o for all source classes
```kotlin
// FILE: AB.kt
interface A {
    val x: Int = 1
}

interface B : A {
    // f/o val x: Int
    //    overrides: A.x
}

// FILE: C.java
public interface C extends B {
    // f/o val x: Int
    //    overrides: (B, A.x)
}

// FILE: D.java
public interface D extends C {
    // f/o val x: Int
    //    overrides: (C, A.x)
}

// FILE: usage.kt
fun test(d: D) {
    d.x
}
```

In such test backend will ask for overriddens of lazy property C.x only
  after property lowering, which removes property `B.x` and replaces it
  with getter `B.<get-x>`. That fact that there is no property anymore
  really confuses `SpecialFakeOverrideSymbolsResolver` during computation
  of overriddens of `C.x`.
So, to prevent this situation, we can process all source kotlin classes
  beforehand, so when any lazy function/property will start computation
  of its overriddens, there won't be the need to calculate mapping of
  f/o for classes

This problem was found during work on KT-66341, after total signature
  computation removal from fir2ir. Previously those fake-overrides just
  matched by signature in symbol table
2024-03-06 08:28:24 +00:00
Dmitriy Novozhilov e8f8399af4 [FIR2IR] Properly cache generated data/value class members
FIR instances of generated toString/hashCode/equals are session dependant,
  so we need some cache, which operates only session-independent stuff.
  Pair of `FirClass` and `Name` was chosen here

Previously SymbolTable played the role of this cache (with signatures as
  keys). But it should be replaced in scope of KT-66341 and KT-64990
2024-03-06 08:28:24 +00:00
Dmitriy Novozhilov 52f6868b74 [FIR2IR] Don't compose signatures if f/o building with FIR is disabled
^KT-66341 Fixed
2024-03-06 08:28:24 +00:00
Dmitriy Novozhilov 3166a61b15 [FIR2IR] Remove unused methods from FirBasedSignatureComposer
^KT-66341
2024-03-06 08:28:24 +00:00
Kirill Rakhman 4c93e9cff6 [FIR] Fix captured type arguments of local class as callable reference LHS
#KT-66267
2024-03-06 08:22:42 +00:00
Kirill Rakhman 66212c0ec6 [FIR] Add todo about isValidTypeParameterFromOuterDeclaration
#KT-66349
2024-03-06 08:22:41 +00:00
Dmitriy Novozhilov 624bea3ecf [FIR] Never create ConeSubstitutorByMap with empty substitution
Relates to KT-66323
2024-03-06 06:40:28 +00:00
Igor Chevdar 6c691b497a [K/N] Added a benchmark on string array loop 2024-03-06 06:14:18 +00:00
Igor Chevdar 27a4cb6c12 [K/N][IR] Fixed wrong type in IR around enums 2024-03-06 05:21:32 +00:00
Igor Chevdar 17d79dafb1 [K/N][IR] Fixed wrong type in IR around ImmutableBlob 2024-03-06 05:21:31 +00:00
Igor Chevdar faf5a7fecc [K/N] Handle conservative type approximations in functional types
Sometimes FE resolves type as an intersection type which gets approximated to Nothing
(as a part of a functional type for function references), this commit tries to workaround
this by getting this type from the referenced function
2024-03-06 05:21:31 +00:00
eugene.levenetc 1f49e01f1a [ObjCExport] Add suspend function and @Throws tests
KT-66115, KT-66239
2024-03-05 22:52:17 +00:00
eugene.levenetc ac1f664a65 [ObjCExport] Add extras to ObjCExportStub for proper @Throws translation
KT-66239
2024-03-05 22:52:17 +00:00
eugene.levenetc 42d8db1c52 [ObjCExport] Fix suspend function and @Throws translations
KT-66115, KT-66239
2024-03-05 22:52:17 +00:00
Alexander Shabalin b7d1126861 [K/N] Remove outdated kotlin-backend-native-for-ide
Unused as of 0713866c1e
2024-03-05 21:47:43 +00:00
Alexander Shabalin d04e295e28 Update verificationMetadata 2024-03-05 21:47:43 +00:00
Alexander Shabalin e8202c3355 [K/N] Simplify dependencies around kotlin-native/ 2024-03-05 21:47:43 +00:00
Alexander Shabalin 24ede14e37 [K/N] Convert :kotlin-native:backend.native buildscript to kts
Use folder structure from the rest of the project and build it by
the bootstrap compiler.
2024-03-05 21:47:43 +00:00
Alexander Shabalin 0542b62430 [K/N] Extract :native:cli-native from kotlin-native/backend.native/cli.bc 2024-03-05 21:47:43 +00:00
Alexander Shabalin bce550dce4 [K/N] Move llvm interop generation to kotlin-native/llvmInterop/ 2024-03-05 21:47:43 +00:00
Alexander Shabalin ab62632a85 [K/N] Move files, env interop generation to kotlin-native/common/ 2024-03-05 21:47:43 +00:00
Alexander Shabalin 9f0a6537bb [K/N] Convert :kotlin-native:Interop:StubGenerator
Use folder structure from the rest of the project and build it by
the bootstrap compiler.
2024-03-05 21:47:43 +00:00
Alexander Shabalin d7bccaef42 [K/N] Convert :kotlin-native:Interop:Skia buildscript to kts
Use folder structure from the rest of the project and build it by
the bootstrap compiler.
2024-03-05 21:47:43 +00:00
Alexander Shabalin 3a5f33e9cd [K/N] Convert :kotlin-native:klib
Use folder structure from the rest of the project and build it by
the bootstrap compiler.
2024-03-05 21:47:43 +00:00
Alexander Shabalin ec8bc6a64f [K/N] Convert :kotlin-native:utilities:cli-runner buildscript to kts
Use folder structure from the rest of the project and build it by
the bootstrap compiler.
2024-03-05 21:47:43 +00:00
Mikhail Glukhikh e8ba534904 K1/K2: add tests confirming behavior of remaining KT-63242 cases 2024-03-05 20:19:02 +00:00
Sergej Jaskiewicz 0008e832d8 [PowerAssert] Improve the accuracy of locating infix operator tokens
Use KotlinLexer to determine the correct offset of an infix operator
token instead of skipping whitespaces after the operator's LHS.

This fixes cases like this:

```
assert("Name"/*in*/in/*in*/listOf("Hello", "World"))
              |            |
              |            [Hello, World]
              false
```
2024-03-05 18:54:06 +00:00
Sergej Jaskiewicz 54c58671fb [PowerAssert] Correctly align infix calls for built-in operators
Instead of searching for the operator in the string representation of
the whole expression, consider the operator's start to be the
first non-whitespace non-dot character _after_ the LHS of the infix
expression.

This fixes cases like this:
```
assert("Name in " in listOf("Hello", "World"))
             |       |
             |       [Hello, World]
             false
```

^KT-66208 Fixed
2024-03-05 18:54:06 +00:00
Sergej Jaskiewicz 7d22825176 [PowerAssert] Reproduce KT-66208 2024-03-05 18:54:06 +00:00
cristiangarcia 540df2944b XcodeValueSource needs to return a Serializable object
Required for KTI-1553
2024-03-05 18:52:33 +00:00
Kirill Rakhman b4413776ab [Raw FIR] Build if - else if - else as two nested whens
This is necessary for inference to work like in K1 because we only
add equality constraints from expected types on top-level `when`, not
on nested ones.

#KT-65882
2024-03-05 17:38:59 +00:00