Commit Graph

109632 Commits

Author SHA1 Message Date
Jinseong Jeon d4d2bae630 AA: add tests about wildcard suppress
^KT-61734
2024-03-07 10:16:58 +00:00
Jinseong Jeon 5d730233cd Migrate Jvm(Suppress)?Wildcard(s)? FqName (and ClassId) 2024-03-07 10:16:58 +00:00
Sebastian Sellmair 10cf97f05b [ObjCExport] Support exported library modules
This new module gives the ability to resolve symbols
from provided klib KtLibraryModules withing a Analysis Session.

^KT-65327 Fixed
2024-03-07 09:23:37 +00:00
Sebastian Sellmair b5b7e5f262 [aa-klib-reader] Implement 'analysis-api-klib-reader' for swift- and objc export
This new module gives the ability to resolve symbols
from provided klib KtLibraryModules withing a Analysis Session.

^KT-65327 Fixed
2024-03-07 09:23:37 +00:00
Anastasia.Nekrasova 1bb6f869a2 [K2]: Compiler crashes when array literal is used in delegate expression
FirCallResolver tries to find a
candidate for the delegate's getValue and cannot parse an arrayLiteral
with a nullable coneType.Running
FirCallCompletionResultsWriterTransformer.transformArrayLiteral is
required to find the result type. Therefore, completeCall should not be
invoked with the ResolutionMode from the 'data' param, but rather in
ResolutionMode.ContextIndependent.

#KT-65022 Fixed
2024-03-07 08:57:24 +00:00
Vladimir Sukharev b4bc576d37 [Tests] Add test for kt33411
^KT-33411 Fixed


Merge-request: KT-MR-14782
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2024-03-07 08:46:05 +00:00
Dmitrii Gridin 928fb94052 [FIR] fix internal error on suspend conversion with not-computed return type
^KT-62836 Fixed
2024-03-07 07:49:44 +00:00
Dmitrii Gridin f4096ae8e9 [FIR] add test case on more suspend conversion with more specific implicit type
^KT-62836
2024-03-07 07:49:44 +00:00
Dmitrii Gridin edd9f0348e [LL FIR] LLFirReturnTypeCalculatorWithJump: add checkCanceled
`tryCalculateReturnTypeOrNull` is the entry point for foreign symbols
resolution. We already have `checkCanceled` inside `lazyResolveToPhase`
and `checkIsResolved`, but in this case we will cover cases where
everything around is already resolved

^KTIJ-27504
2024-03-07 07:43:40 +00:00
Yan Zhulanow 4cbd431d22 [Pill] Enable Pill for scripting tests 2024-03-07 06:25:00 +00:00
Yan Zhulanow 507ab1e619 [Pill] Enable Pill for Swift export modules 2024-03-07 06:25:00 +00:00
Alexander Udalov 7d4ad9d9f9 JVM IR: slightly optimize IrType.asJvmFlexibleType
#KT-66281
2024-03-06 22:03:10 +00:00
Alexander Udalov 47a4ee7fdf IR, JS: remove duplicate FQ name check from hasEqualFqName
`hasEqualFqName` is called from `hasAnnotation`, which takes more than
1% of total backend time, so it's important to avoid doing extra work
here.

It seems to be a quirk of the JS IR backend specifically that
`JsExport.Ignore` has incorrect IR parent structure here; for all other
backends, checking FQ name by traversing IR parents should work fine.

 #KT-66281
2024-03-06 22:03:10 +00:00
Alexander Udalov d430673320 JVM IR: optimize type equality check on IR types
`AbstractTypeChecker.isCommonDenotableType` calls a few functions which
check if the type is flexible, which is not cheap in case of JVM IR, see
`asFlexibleType`.

 #KT-66281
2024-03-06 22:03:10 +00:00
Alexander Udalov 45b74d0313 IR: simplify IrOverrideChecker.isOverridableByWithoutExternalConditions
Inline property-related utilities to the only call site, rearrange the
code to make declarations closer to their usages, etc.
2024-03-06 22:03:10 +00:00
Vyacheslav Gerasimov 879aa33a9c Build: Apply ConcurrencyLimitService to all tests tasks in the project
Some project tasks are not created with projectTest helper, but all
tasks should be limited since we can't use `--no-parallel` on CI
2024-03-06 21:45:41 +01:00
Jinseong Jeon b47a33cf9d Back to getOrDefault test
The main purpose was to test getOrDefault w/ non/null value does not
bother the resolution. To be aligned with test file
mapGetOrDefault_nullable.kt, this one should test getOrDefault too.
All we needed was // WITH_STDLIB
2024-03-06 19:26:52 +00:00
Wojciech Litewka cbabfc0fe2 [IR] Drop ir.ir2cfg module
#KTI-952 Fixed
#KT-65773 Related
2024-03-06 18:30:22 +00:00
Ilya Goncharov 6fb6f04509 [Gradle, Wasm] Not add target listeners for wasi projects
^KT-66373 fixed
2024-03-06 18:23:41 +00:00
Ilmir Usmanov 0bb6359ac5 Minor. Add regression tests
#KT-64725 Fixed
 #KT-64726 Fixed
 #KT-64727 Fixed
2024-03-06 18:16:59 +00:00
Svyatoslav Scherbina b4c2164837 [K/N][tests] Fix kt42208WithPassingLambdaToAnotherFunction.kt for K2
It seems that K2 doesn't support `UnitConversionsOnArbitraryExpressions`
experimental language feature (KT-56011), while the test accidentally
relied on it.

Improve the test code so that it doesn't need this language feature
anymore, and enable the test for K2.

^KT-65553 Fixed
2024-03-06 17:07:27 +00:00
Denis.Zharkov b7129f78a3 K2: Fix IAE at Candidate.updateSourcesOfReceivers inside PCLA lambda
Previously, it was failing at line
(resolvedReceiver?.toReference(session) as? FirNamedReferenceWithCandidate)?.candidate?.updateSourcesOfReceivers()

But this line was mostly incorrect because in case of `a.b()` call,
which is resolved to `a.b.invoke()`, `resolvedReceiver` is pointing to
`a` instead of obviously expected `a.b`.

The fix with using `candidate.callInfo.explicitReceiver` doesn't help
either because the candidate of that receiver is always completed at
that stage (so no Candidate there).

The only case when the candidate was still there is PCLA because
 in that case we explicitly don't fully complete even receiver
expressions.
(see docs/fir/pcla.md)

The idea of the fix is moving the call of `updateSourcesOfReceivers`
for invoke property receiver to the place just before the candidate
is being converted to the resolved reference
(i.e., the candidate is being lost)

^KT-66148 Fixed
2024-03-06 17:01:57 +00:00
Dmitrii Gridin ae9c9b051f [FIR] do not use MUTE_LL_FIR for multiplatform tests 2024-03-06 16:13:09 +00:00
Dmitrii Gridin c090ae96ab [LL FIR] update attached issue
^KT-66352
2024-03-06 16:13:09 +00:00
Dmitrii Gridin 124453016d [LL FIR] Replace IGNORE_REVERSED_RESOLVE + IGNORE_NON_REVERSED_RESOLVE with MUTE_LL_FIR 2024-03-06 16:13:09 +00:00
Dmitrii Gridin 9ea9950d28 [LL FIR] Replace IGNORE_DIAGNOSTIC_API with IGNORE_NON_REVERSED_RESOLVE 2024-03-06 16:13:09 +00:00
Dmitrii Gridin 28c80a1581 [LL FIR] StubBasedFirMemberDeserializer: add missed deprecation provider
^KT-60996 Fixed
2024-03-06 16:13:09 +00:00
Dmitrii Gridin 805b7bc8f4 [Analysis API] add diagnostic tests on deprecated declarations
^KT-60996
2024-03-06 16:13:09 +00:00
Dmitrii Gridin 9cc2c22116 [Analysis API] drop obsolete tests
They were renamed during 2ce324f1fc,
but old wasn't dropped
2024-03-06 16:09:43 +00:00
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