Commit Graph

97291 Commits

Author SHA1 Message Date
Marco Pennekamp a777ffcd8a [AA] KT-55566 StandaloneProjectFactory: Setup JDK default module roots
- Setup JDK default module roots in `StandaloneProjectFactory` (compare
  with `KotlinCoreEnvironment`). The implementation is a distilled
  version of `ClasspathRootsResolver`'s default module handling.
- This fixes an issue where some LL FIR tests with JDK 17 and 11 had
  mismatched types between Kotlin and Java sources.

^KT-55566 fixed
2023-01-04 11:46:11 +00:00
Marco Pennekamp e68111c218 [AA] KT-55566 StandaloneProjectFactory: Setup Java language level before Java files are parsed
- LL FIR tests with Java `record` classes and other new syntax features
  failed because `file.packageName` in `findJvmRootsForJavaFiles`
  caused the Java file to be parsed before the Java language level was
  configured. The Java language level is now set up in
  `registerJavaPsiFacade`, which is early enough.
2023-01-04 11:46:10 +00:00
Pavel Mikhailovskii fed86a57e3 Fix isValidJavaFqName 2023-01-04 11:28:08 +00:00
Dmitriy Novozhilov 4f3add8f7a [FIR] Fix resolution of plugin annotations if only meta annotations are registered 2023-01-04 11:02:01 +00:00
Mikhail Glukhikh 0d50f71fb8 K2: expand type aliases in annotation position #KT-55615 Fixed 2023-01-04 10:06:39 +00:00
Svyatoslav Kuzmich 3cf811012a [Wasm] Reenable gradle integration tests for node and binaryen
* Update to supported node.js version
* Add missing binaryen flag

Merge-request: KT-MR-8180
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-01-04 08:35:06 +00:00
Stanislav Ruban 451e27fd46 Regenerate Analysis API tests to include new test cases 2023-01-04 08:08:33 +00:00
Stanislav Ruban ca8cfa4596 KT-55335: Add diagnostics test showing that issue is fixed in K2
^KT-55335: Fixed
2023-01-04 08:08:33 +00:00
Stanislav Ruban 965015bb1e KT-55288: Add diagnostics test showing that issue is fixed in K2
^KT-55288: Fixed
2023-01-04 08:08:32 +00:00
Stanislav Ruban 0f179e8949 KT-33132: Add diagnostics test showing that issue is fixed in K2
^KT-33132: Fixed
2023-01-04 08:08:32 +00:00
Vladimir Dolzhenko 4542b3947b Clean up: rename Jet* to Kt* 2023-01-03 16:36:53 +01:00
Vladimir Dolzhenko d6e587171e Optimize isDefinitelyNotSamInterface
Do not generate intermediate garbage and no reason to iterate over
all non-SAM candidates when more than one found

#KTIJ-23032
2023-01-03 14:36:01 +00:00
Alexander Udalov 397cafcbe8 Remove unneeded runReadAction in getExceptionMessage
Read action is not needed because at the only call site where we try to
read the PSI element text we do it via `Document.getCharsSequence` which
does not require read action.

 #KT-54971 Fixed
2023-01-03 14:23:35 +00:00
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