Commit Graph

97278 Commits

Author SHA1 Message Date
Ilya Goncharov a0211fc5fe [Gradle, JS] Deprecation of BOTH and LEGACY consts
^KT-55593 fixed
2023-01-03 12:47:11 +00:00
Alexander Korepanov 3744fbb31b [JS IR] Write IrFile fingerprints to KotlinJs klib manifest
The file fingerprints are going to be used for
 a cache invalidation in JS IR incremental cache.

 It should reduce an incremental rebuild time in JS BE.

 CityHash128 is used as IrFile fingerprint.
2023-01-03 12:30:23 +00:00
Vladimir Dolzhenko 511e05adec Fix test data
Test data had to be adjusted together with a main change

#KTIJ-912
2023-01-03 11:46:20 +00:00
Ilya Kirillov 4a31f82b14 [FIR] use whileAnalysing instead of direct exception handling 2023-01-03 10:23:50 +00:00
Ilya Kirillov 79fe4100aa [FIR] extract exception handing into a service to have additional implementation for the ide 2023-01-03 10:23:50 +00:00
Ilya Kirillov 90436abb23 [FIR] add FirSession parameter to whileAnalysing
It will be needed in the following commits
2023-01-03 10:23:49 +00:00
Alexander Udalov d6d8bf4cbd Update year to 2023 in COPYRIGHT.txt and NOTICE.txt 2023-01-02 22:52:18 +01:00
Alexander Udalov ae6d4d268d Use short copyright from COPYRIGHT_HEADER in generated files 2023-01-02 22:52:18 +01:00
Alexander Udalov 3c4b5529af Update year to 2023 in COPYRIGHT_HEADER.txt
This commit is the result of changing the year to 2023 in
COPYRIGHT_HEADER.txt and running all `generate*` tasks in
`generators/build.gradle.kts`.
2023-01-02 22:52:15 +01:00
Alexander Udalov 7b8b6ef98f Use COPYRIGHT_HEADER in generateBuiltins
It's the same logic that is used in generateTests, and it prevents
master builds from failing as soon as the new year begins. The year in
the COPYRIGHT_HEADER should be updated manually anyway, after which all
the generators will need to be re-run.
2023-01-02 22:50:06 +01:00
Alexander Udalov 2d3f39d1f1 Minor, remove unneeded println in GenerateInterpreterMap 2023-01-02 22:50:06 +01:00
Alexander Udalov 5cb8428326 Minor, remove obsolete bunch file 2023-01-02 22:50:06 +01:00
Dmitrii Gridin 5c6cf57e23 [AA] KtSymbolPointer: add info about semantic to kdoc
^KT-55191
2023-01-02 20:00:50 +00:00
Dmitrii Gridin 0a436d48df [AA] KtSymbolPointer: update kdoc
^KT-55191
2023-01-02 20:00:50 +00:00
Dmitrii Gridin 397f7719d8 [SLC] compareSymbolPointers: add identity check as fast check
^KT-55191
2023-01-02 20:00:50 +00:00
Dmitrii Gridin 25d5a26a72 [AA] KtSymbolPointer: fix comment reference 2023-01-02 20:00:49 +00:00
Dmitrii Gridin 0a003be1f0 [SLC] avoid symbol restoring during comparison
^KT-55191 Fixed
2023-01-02 20:00:49 +00:00
Dmitrii Gridin 13917887e0 [AA] KtSymbolPointer: introduce pointsToTheSameSymbolAs method
^KT-55191
2023-01-02 20:00:49 +00:00
Ilya Chernikov 19a0a1fcd8 K2: add missing MPP warning in LightTree mode 2023-01-02 19:54:57 +00:00
Ilya Chernikov 73e0a5ccd3 K2: Use LightTree by default in modularized tests 2023-01-02 19:54:57 +00:00
Ilya Chernikov 47a4532ea0 K2: update LightTree support in modularized tests 2023-01-02 19:54:56 +00:00
Ilya Chernikov 1a373317ed K2: temporarily disable scripts compilation in LT mode
Should be addressed in the new K2 scripting support soon
2023-01-02 19:54:56 +00:00
Ilya Chernikov 23a27864e5 K2: introduce LT mode config property 2023-01-02 19:54:56 +00:00
Ilya Chernikov 16f52f4c50 K2: use LightTree by default with K2 2023-01-02 19:54:55 +00:00
Mads Ager 35e94a1ef7 [K/N] Fully rename parameters based on ObjCName annotations.
The original name was still left in the ObjC code for cases
such as:

```
class A(@property:ObjCName("y") @ObjCName("y") val x: Int)
```

which compiled to:

```
@interface FrameworkA : FrameworkBase
- (instancetype)initWithY:(int32_t)x __attribute__((swift_name("init(y:)"))) __attribute__((objc_designated_initializer));
@property (readonly) int32_t y __attribute__((swift_name("y")));
@end
```

This change renames the `x` ocurrence in `initWithY` which is
important in case ObjCName is used to avoid using names that
conflict with ObjC preprocessor macros.
2023-01-02 18:57:21 +00:00
Marco Pennekamp 5f554d0065 [FIR] KT-54980 Fix resolvability of too few/too many type arguments
- If too few or too many type arguments were provided, they were all
  thrown away in `TypeArgumentMapping`,
  `FirCallCompletionResultsWriterTransformer`, and `KtFirCallResolver`.
  The fix handles type arguments of the wrong arity more gracefully.
  - Note for `TypeArgumentMapping`: Excess type arguments are not needed
    for candidate resolution. Excess type arguments are still resolved
    due to the handling in `FirCallCompletionResultsWriterTransformer`.
- Post-processing in `AllCandidatesResolver`: When all candidates are
  resolved in `AllCandidatesResolver.getAllCandidates`, the function
  builds a FIR file. During that resolution, the
  `generic<String, String>` call (in example
  `functionCallWithTooFewTypeArguments.kt`) is correctly marked as
  inapplicable, but the missing type argument is inferred as an error
  type. `firFile` then contains a function call
  `generic<String, String, ERROR>` instead of `generic<String, String>`.
  This call is still marked as inapplicable. Despite that, the
  *subsequent* resolution by
  `bodyResolveComponents.callResolve.collectAllCandidates` disregards
  the call's inapplicability and resolves successfully into an
  applicable candidate. This is because `CandidateFactory` doesn't make
  any guarantees for already inapplicable calls. The fix adds
  post-processing to `AllCandidatesResolver` to preserve candidate
  inapplicability.
- Most tests that this commit changes had slightly different results due
  to type arguments becoming resolvable.
- `wrongNumberOfTypeArguments.kt` and
  `wrongNumberOfArgumentsInTypeAliasConstructor.kt`:
  `ConeDiagnostic.toFirDiagnostics` prefers specific errors. Because
  `ARGUMENT_TYPE_MISMATCH` is specific and `INAPPLICABLE_CANDIDATE` is
  not, only the former is reported. I see no reason to pass an illegally
  typed argument in either test, so the change reduces the errors to
  `INAPPLICABLE_CANDIDATE`.
- `typeAliasSamAdapterConstructors2.fir.kt`: See KT-55007.
- Disable `mismatchTypeParameters` JS backend test due to its handling
  of excess type arguments. See KT-55250.

^KT-54980 fixed
2023-01-02 16:36:02 +00:00
Pavel Kirpichenkov d6a9235d05 Minor: pass -Xrefines-paths in recommended form
KT-55362
2023-01-02 16:33:24 +00:00
Vladimir Dolzhenko f9f0f561d7 Add ability to decompile multifile classes
A side effect of KotlinClassFileDecompiler#KotlinDecompiledFileViewProvider@factory
that multifile java classes like FilesKt__FilePathComponentsKt.class
becomes not visible with Kotlin plugin as file
jar://..../kotlin-stdlib.jar!/kotlin/io/FilesKt__FilePathComponentsKt.class
is considered as Kotlin internal compiled file and therefore no PsiFile
for this virtualFile

#KTIJ-912

Merge-request: KT-MR-8146
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-01-02 15:31:19 +00:00
Alexander Udalov 7a9c59aeb5 JVM IR: do not serialize metadata for actualized optional expectations
Optional-expectation annotations which have an actual counterpart should
have never been serialized to the kotlin_module's proto. See for example
the original (correct) implementation in the old JVM backend in
`PackageCodegenImpl.addDescriptorToOptionalAnnotationsIfNeeded`.

 #KT-55611 Fixed
2023-01-02 15:30:27 +00:00
Alexander Udalov 11504fda18 Minor, slightly improve rendering for -Xlist-phases
Remove ':' after phase name, render "(Disabled)" instead of "(Enabled)".
2023-01-02 15:26:07 +00:00
Alexander Udalov 3f2b51151f Remove -Xexclude-from-dumping
Apparently the underlying logic was removed in b07690fccf and no one
noticed.
2023-01-02 15:26:07 +00:00
Dmitrii Gridin 6db0aaef35 [SLC] rename test classes according to new directories 2023-01-02 15:05:45 +00:00
Dmitrii Gridin 251a4363f5 [LC][tests] drop outdated '//RELEASE_COROUTINE_NEEDED' directive 2023-01-02 15:05:44 +00:00
Dmitrii Gridin 7196d0d809 [LC] AbstractSymbolLightClassesLoadingTest: sort classes by name 2023-01-02 15:05:44 +00:00
Dmitrii Gridin 27ffe7c31e [LC] move scripts to lightClassByPsi 2023-01-02 15:05:44 +00:00
Dmitrii Gridin 2e2e633113 [LC] fix PsiClassRenderer 2023-01-02 15:05:43 +00:00
Dmitrii Gridin 86bb9eeebc [LC] fix ULC testData 2023-01-02 15:05:43 +00:00
Dmitrii Gridin 7096fc1416 [LC] drop outdated 'CHECK_BY_JAVA_FILE' directive 2023-01-02 15:05:42 +00:00
Dmitrii Gridin 3e36e51920 [LC] merge ultraLightFacades tests to lightClassByPsi 2023-01-02 15:05:42 +00:00
Dmitrii Gridin 3b739d9a44 [SLC] AbstractSymbolLightClassesLoadingTest: generate light class for all compiled classes 2023-01-02 15:05:42 +00:00
Dmitrii Gridin 60ab3fa38e [SLC] AbstractSymbolLightClassesLoadingTest: generate facade if possible 2023-01-02 15:05:41 +00:00
Dmitrii Gridin 1515075387 [LC] regenerate tests after rename 2023-01-02 15:05:41 +00:00
Dmitrii Gridin 0731780865 [LC] rename ultraLightClasses to lightClassByPsi 2023-01-02 15:05:38 +00:00
Dmitrii Gridin 3447fcdd84 [LC] regenerate tests after rename 2023-01-02 15:05:37 +00:00
Dmitrii Gridin 742c3de112 [LC] rename lightClasses/lightClasses to lightClasses/lightClassByFqName 2023-01-02 15:05:37 +00:00
Dmitrii Gridin 81a939409a [LC] regenerate tests after move 2023-01-02 15:05:36 +00:00
Dmitrii Gridin eb3ad7e6b1 [LC] move light class related tests to one directory 2023-01-02 15:05:36 +00:00
Marco Pennekamp 34a1569375 [LL FIR] KT-55339 Fix supertype collection in LL FIR supertype resolver
- LL FIR didn't report a `RECURSIVE_TYPEALIAS_EXPANSION` error on `F2`
  in `recursive.fir.kt`. While the resolver correctly associates `F2`
  with a cyclic error supertype in the supertype computation session,
  that error supertype was never assigned to `F2`.
- Why? `F2`'s supertype is a function type, so the supertype's
  `classLikeDeclaration` in `collect` is `Function1`, which has no
  containing file. Thus, the `Function1` was simply skipped, without
  adding `F2` to the designators to which supertypes are later applied
  via `apply`.
- The fix takes supertypes without containing files into account by
  crawling their type arguments, which possibly leads the collector to
  further designations, such as `F2`, which is reachable via the
  function type's type arguments.

^KT-55339 fixed
2023-01-02 14:45:01 +00:00
Marco Pennekamp 2cdcdce6ed [LL FIR] KT-55327 Use body resolve return type calculator for locals
- LL FIR uses `ReturnTypeCalculatorWithJump` by default because it
  cannot guarantee that the implicit types of non-local functions
  referenced in a function `f` have been resolved during body resolve
  of `f`.
- However, if `ReturnTypeCalculatorWithJump` encountered a local
  function, it tried to resolve its return type even during body
  resolve of that same local function. The fix delegates to
  `ReturnTypeCalculatorForFullBodyResolve`, which should be used for
  local declarations.

^KT-55327 fixed
^KT-55324 fixed
2023-01-02 14:03:42 +01:00
Alexander Udalov 28759a3ac3 Optimize rangeUntil operator in for-loops and contains
Newly added tests are basically copies of the existing tests on `until`.
Note that this operator is optimized for all backends, but the fact that
it's optimized is only checked for the JVM backend in bytecode text
tests.

 #KT-53330 Fixed
2023-01-02 12:55:48 +00:00