Commit Graph

97760 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 8bd3c9d019 [FIR] Don't transform nested classes during class update because of @JvmRecord annotation
^KT-55703 Fixed
2023-01-17 14:51:28 +00:00
Dmitriy Novozhilov ad191eb179 [Test] Add test for KT-55703 2023-01-17 14:51:28 +00:00
Dmitriy Novozhilov 4363b0815c [FIR] Add ability to specify if meta annotation itself should match metaAnnotated predicate
^KT-55843 Fixed
2023-01-17 14:51:28 +00:00
Dmitriy Novozhilov e88a6af7a0 [JS Test] Include friend modules in list of all dependencies in compiler configuration 2023-01-17 14:51:27 +00:00
Dmitriy Novozhilov 83cbd322fd [Test] Prohibit declaring dependency on the same module with different kinds in module structure 2023-01-17 14:51:27 +00:00
Dmitriy Novozhilov c71b80823c [Test] Cleanup code of ModuleStructureExtractorImpl.kt 2023-01-17 14:51:27 +00:00
Yahor Berdnikau 5c8b8bf009 Remove Gradle plugin variants from ':kotlin-gradle-statistics'
Code does not use any Gradle API imports and does not use any KGP API
classes.
2023-01-17 14:03:53 +00:00
Yahor Berdnikau 92509ad400 Remove Gradle plugin variants from ':kotlin-gradle-build-metrics'
Code does not use any Gradle API imports and does not use any KGP API
classes.
2023-01-17 14:03:53 +00:00
Mikhail Glukhikh 5af37e4647 kotlin-reflect: split K2/K1 branches in KotlinModuleShadowTransformer 2023-01-17 13:46:52 +00:00
Vyacheslav Gerasimov b4071e1bbe Build: Add a separate task for K2 native codegen box tests 2023-01-17 14:25:14 +01:00
Vladimir Sukharev e4d209cbde [K2] [KN-55977] Fix suspend type serialization
Merge-request: KT-MR-8328
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-01-17 13:07:21 +00:00
Jinseong Jeon b088e742ae Introduce a util to copy TypeMappingMode for UAST 2023-01-17 13:56:42 +01:00
Jinseong Jeon e89a387cd4 Optimal type mapping modes for UAST
As shown in (DEFALUT | GENERIC_ARGUMENT)_UAST, UAST's PsiType mapping
needs an automatic expansion of type alias. This commit makes utils that
generate optimal type mapping modes for return / parameter to consider
if this is used for UAST. In that case, utils will set `mapTypeAliases`
true so that typealias (even inside type arguments) can be expanded
properly.
2023-01-17 13:56:41 +01:00
Dmitrii Gridin 485fad1951 [FIR] FirJavaClass: make annotations and deprecationsProvider lazily enhanced
^KT-55387
2023-01-17 12:45:53 +00:00
Hung Nguyen 908dbf32cf IC: Clean up closing caches logic in IncrementalCompilerRunner.kt
Make the code more readable and address a small issue where we
did not close caches when returning `ICResult.RequiresRebuild`
(it was not exactly a correctness issue because we would recompile
non-incrementally in that case).

^KT-55709 In progress (This is a follow-up on a previous change for this
    bug)
2023-01-17 17:22:59 +05:30
Anna Kozlova 6f9cfe1943 [AA] don't treat broken code as function type parameter
inspired by KTIJ-23940
2023-01-17 11:50:20 +00:00
Nicklas Ansman Giertz 115bc6ac89 KAPT: Fix an ISE when processing unresolved generic types
Error types that are generic could sometimes throw an ISE when
generating the stub.

This fixes KT-43786
2023-01-17 11:40:13 +01:00
Vsevolod Tolstopyatov 21fe0e80ff [K2] Report CONCURRENT_HASH_MAP_CONTAINS_OPERATOR_ERROR for class hierarchies
Previously it wasn't reported in FIR for ConcurrentHashMap inheritors
because the receiver id hasn't matched CHM.contains id
Fixed by unwrapping origin of the call in case of fake overrides

^KT-55606 fixed
2023-01-17 09:46:25 +00:00
Dmitriy Novozhilov b09561c3c3 [FE 1.0] Deprecate declaration of expect and actual in the same module
^KT-40904 Fixed
^KT-55177 Fixed
2023-01-17 09:43:14 +00:00
Bogdan Mukvich 71a80c5e36 Reproducible build should not run as root inside docker 2023-01-17 09:33:30 +00:00
Svyatoslav Kuzmich 951b8026f5 [JS, Wasm] Don't generate unused constructors for interfaces 2023-01-17 09:14:57 +00:00
Nikolay Lunyak 23301e3369 [FIR] Remove annotations.any from FirParcelizeAnnotationChecker 2023-01-17 06:26:39 +00:00
Nikolay Lunyak 4cddbb5fc0 [FIR] Get rid of FirAnnotation.fullyExpandedClassId
It's duplicated by `toAnnotationClassId`.
2023-01-17 06:26:39 +00:00
Nikolay Lunyak 343b856cfc [FIR] Expand typealiases in FirNativeObjC checkers 2023-01-17 06:26:39 +00:00
Nikolay Lunyak f8643c90eb [FIR] Remove annotations.find {} from FirJvmRedundantRepeatableChecker 2023-01-17 06:26:38 +00:00
Nikolay Lunyak d105ce8681 [FIR] Support typealiases to java Repeatable 2023-01-17 06:26:38 +00:00
Nikolay Lunyak 2e8b177262 [FIR] Support typealiases in FirJsRuntimeAnnotationChecker 2023-01-17 06:26:37 +00:00
Nikolay Lunyak fc285c079e [FIR] Support typealiases in FirJsAbstractNativeAnnotationChecker 2023-01-17 06:26:37 +00:00
Nikolay Lunyak aaf30c2695 [FIR] Warn about unexpanded in extractDeprecationAnnotationInfoPerUseSite
This code may be called during status resolution, but
it can also be called during `COMPILER_REQUIRED_ANNOTATIONS`.
In the latter case we can't expand typealiases.

If we do try to expand typealiases if we can,
and leave them unexpanded otherwise, then we
still may have a problem. Consider the
FirBlackBoxCodegenTestGenerated.Reflection.Annotations.Repeatable
.testKotlinAnnotation test.
In this test we get the following cycle:

```
import kotlin.annotation.AnnotationTarget.* // <- requires TYPEALIAS

@SinceKotlin("1.1") // <- requires String
AnnotationTarget.TYPEALIAS

@IntrinsicConstEvaluation // <- fully expanding this requires
fun String.compareTo()    //    building it

@Target(AnnotationTarget.CONSTRUCTOR)     // <- requires
annotation class IntrinsicConstEvaluation //    AnnotationTarget
                                          //    in general

// The cycle repeats
```

Or in words if the picture isn't clear:

- Transform `import kotlin.annotation.AnnotationTarget.*`
- Find and deserialize class `kotlin/annotation/AnnotationTarget`
- Load the `TYPEALIAS` field
- Load its annotation `@SinceKotlin("1.1")`
- Find and deserialize `kotlin/String` for `"1.1"`
- Load `String.compareTo`
- Load its annotation `kotlin/internal/IntrinsicConstEvaluation`
>>> At this moment the `extractDeprecationAnnotationInfoPerUseSite`
function is called, and ideally we'd want to fullyExpand
`IntrinsicConstEvaluation`
- While calling `toAnnotationClassId` for it, we find and deserialize
`IntrinsicConstEvaluation`
- `IntrinsicConstEvaluation` has `@Target`
- At this moment we find and deserialize `AnnotationTarget` again.
But This time loading `@SinceKotlin("1.1")` succeeds,
because when loading `kotlin/String` we first create the symbol, then
cache it, then call `postCompute`.
It does not happen with `AnnotationTarget`, because it calls
`findAndDeserializeClass` during `createValue`,
not `postCompute`.
- Thus, we have duplicate `AnnotationClass`-es, and they fail in fir2ir
with "symbol is already bound"

We can't move `findAndDeserializeClass` into `postCompute`, because
during this process when we try to access the
already created and cached symbol for `AnnotationTarget`
(with yet empty fir) we are trying to build the declared member scope
by this `symbol.fir`.
2023-01-17 06:26:36 +00:00
Nikolay Lunyak f671a8c8a7 [FIR] Rename FirAnnotation.coneClassLikeType to unexpanded
The same reason
2023-01-17 06:26:36 +00:00
Nikolay Lunyak 0c86294ca4 [FIR] Rename FirAnnotation.classId to unexpandedClassId
This makes the eye catch each such thing in the source.
OptIn isn't that catchy, plus it may be declared
for the whole file, so noticing may be harder
2023-01-17 06:26:36 +00:00
Nikolay Lunyak cf73d59e29 [FIR] Remove FirAnnotation.classId from FirParcelize
The same reasoning as with the serialization. If we
decide to support it, we wouldn't need to think
about unexpanded types.
2023-01-17 06:26:35 +00:00
Nikolay Lunyak 647cdb1c9a [FIR] FirSerializationPluginClassChecker
This change affects nothing, because @Serializable is checked during
COMPILER_REQUIRED_ANNOTATIONS when typealiases
are not yet resolved, but in case we change something
in the Future and want to support it, we'd have one less problem
2023-01-17 06:26:35 +00:00
Nikolay Lunyak 6a1c9e9279 [FIR] Support typealiases in FirAssignAnnotationMatchingService 2023-01-17 06:26:35 +00:00
Nikolay Lunyak 0c00e79024 [FIR] Support typealiases in FirTypeAnnotationChecker
`directExpansionType` is needed here for cases like
`typealias S = @S Suppress`. Otherwise, `fullyExpandedType`
would cache the same typealias
2023-01-17 06:26:34 +00:00
Dmitrii Gridin 927d244682 [SLC] cleanup code 2023-01-16 18:00:43 +00:00
Dmitrii Gridin 6fb59cc19b [SLC] update copyrights 2023-01-16 18:00:43 +00:00
Dmitrii Gridin b05ade63cb [SLC] SymbolLightAccessorMethod: simplify isOverride for top-level case 2023-01-16 18:00:43 +00:00
Nikolay Lunyak c3b871652f [FIR] KT-55181: Ensure throw argument is Throwable
`TYPE_MISMATCH` in `throwJLException.fir.kt` appeared,
because in `throw Exn` the type of `Exn` is implicit Unit.
This is red code anyway.

^KT-55181 Fixed

Merge-request: KT-MR-8292
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-01-16 17:24:22 +00:00
Egor Kulikov 842ad56266 [PSI] Fix highlightning hangs in libraries
Fixes ^KTIJ-23875
findChildrenByType was errorneously replaced with
getStubOrPsiChildrenAsList

Merge-request: KT-MR-8165
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-01-16 17:24:05 +00:00
Mikhail Glukhikh 38b4bade40 K2/Native: use language version 2.0 instead of -Xuse-k2 in tests 2023-01-16 18:16:49 +01:00
Mikhail Glukhikh a13fd033fc Give slightly better names to language/API version variables in FP tests 2023-01-16 18:16:49 +01:00
Mikhail Glukhikh 70fc891260 K2: move -Xuse-k2 VS language version checks to CommonCompilerArguments 2023-01-16 18:16:49 +01:00
Mikhail Glukhikh 7a61578e08 Language version 2.0: fix compiler messages and minor details 2023-01-16 18:16:48 +01:00
Mikhail Glukhikh cbedbda527 Enhance API/messages around BinaryVersion / JvmMetadataVersion 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh 13502abab9 Fix FIR bootstrap in version 2.0 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh bbeae23b04 Allow to read metadata 2.0 from version 1.8 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh 0c4a0360ac Deserialization/class reading: pass chosen JvmMetadataVersion whenever possible 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh 52ab565cc6 Move LANGUAGE_TO_METADATA_VERSION to compiler:frontend.common.jvm 2023-01-16 18:14:52 +01:00
Mikhail Glukhikh 89dd28226b BinaryVersion: introduce isCompatibleWithCurrentCompilerVersion 2023-01-16 18:12:55 +01:00