Commit Graph

47922 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 6740a596c7 [Frontend] Provide ProjectExtensionDescriptor for DiagnosticSuppressor
`DiagnosticSuppressor` didn't contain `ProjectExtensionDescriptor`, which
  prevented usages of this extension point with API provided by
  `CompilerPluginRegistrar`

See discussion in KT-60952
2024-03-07 15:33:07 +00:00
Nikolay Lunyak 7f12af9452 [FIR] Ensure KT-66161 is not reproducible in the compiler
^KT-66161


Merge-request: KT-MR-14730
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2024-03-07 15:10:18 +00:00
Igor Yakovlev 60d425e2c7 [Wasm] Make specialisations for closured primitive values
Fixed KT-66065
2024-03-07 14:51:02 +00:00
Wojciech Litewka 4eba0075bb [IR] Autogenerate IrFileImpl
#KT-65773 In Progress
2024-03-07 14:32:31 +00:00
Wojciech Litewka 2ed0ffd123 [IR] Autogenerate IrExternalPackageFragmentImpl
#KT-65773 In Progress
2024-03-07 14:32:31 +00:00
Wojciech Litewka f92670024e [IR] Autogenerate IrErrorDeclarationImpl 2024-03-07 14:32:31 +00:00
Wojciech Litewka 2b26163030 [IR] Temporarily move to-be-autogenerated files under gen directory 2024-03-07 14:32:31 +00:00
Wojciech Litewka 46162395be [IR] Extract IrFileImpl secondary constructors to functions
#KT-65773 In Progress
2024-03-07 14:32:31 +00:00
Wojciech Litewka 943be239ee [IR] Simplify IrFileImpl and IrExternalPackageFragment
#KT-65773 In Progress
2024-03-07 14:32:31 +00:00
Wojciech Litewka 16ae7651a2 [IR] Simplify IrErrorDeclarationImpl for autogeneration
#KT-65773 In Progress
2024-03-07 14:32:31 +00:00
Dmitriy Novozhilov 4b5eac7816 [Test] Add regression tests for issues which are fixed in K2
Related issues:
KT-10879, KT-18055, KT-20617, KT-23873
KT-25668, KT-31191, KT-33108, KT-41013
KT-51827, KT-53886, KT-56624, KT-58447
KT-58458, KT-58751, KT-58814, KT-60597
KT-62806, KT-63258, KT-63444, KT-65101
KT-65408, KT-65844, KT-66186

^KT-65926 Fixed
2024-03-07 12:49:47 +00:00
Dmitriy Novozhilov b875ae774e [FIR] Unwrap captured types in target type of SAM conversion
^KT-66256 Fixed
2024-03-07 12:41:05 +00:00
Vladimir Sukharev a9af52c288 [Tests] Add test for KT-44199
^KT-44199 Fixed
2024-03-07 11:36:49 +00:00
Vladimir Sukharev 1ad0872958 [Tests] Port FilePathsInKlibTest to K2 ^KT-64452
Used frontend changed for K2
It turned out test was compiling only one source file (a.kt). Test adjusted, so all three source files(a.kt, b/c.kt, c/d/e.kt) are now compiled into klib, so more usecases are tested
^KT-64452 Fixed

Merge-request: KT-MR-14700
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2024-03-07 10:49:07 +00:00
Mikhail Glukhikh c04a8fc3b8 K1/K2: add test cases for KT-53792 and KT-66369 2024-03-07 10:25:11 +00:00
Jinseong Jeon 09f384d96e FIR: assure annotation argument mapping is ready
^KT-66223 fixed
2024-03-07 10:17:01 +00:00
Jinseong Jeon afd20b0c2d SLC: honor wildcard suppression on declarations
^KT-61734 fixed
2024-03-07 10:17:00 +00:00
Jinseong Jeon d63b3e9494 Extend JvmWildcardSuppress annotation tests
^KT-61734
2024-03-07 10:17:00 +00:00
Jinseong Jeon 94e5653eb7 Migrate utils to check/alter TypeMappingMode according to suppress wildcard annotations
^KT-61734
2024-03-07 10:16:59 +00:00
Jinseong Jeon 5d730233cd Migrate Jvm(Suppress)?Wildcard(s)? FqName (and ClassId) 2024-03-07 10:16:58 +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
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
Wojciech Litewka cbabfc0fe2 [IR] Drop ir.ir2cfg module
#KTI-952 Fixed
#KT-65773 Related
2024-03-06 18:30:22 +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
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
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 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
Mikhail Glukhikh e8ba534904 K1/K2: add tests confirming behavior of remaining KT-63242 cases 2024-03-05 20:19:02 +00:00