Commit Graph

3314 Commits

Author SHA1 Message Date
pyos d6fdd6734e jvm-abi-gen: sort inner classes 2022-12-28 14:42:33 +01:00
pyos 26a7ac6d92 jvm-abi-gen: keep InnerClass attributes for all referenced types
^KT-55233 Fixed
2022-12-28 14:42:33 +01:00
Pavel Mikhailovskii 06d3e1d8bd KT-55005 Do not generate CHECKCAST before AASTORE 2022-12-21 15:06:07 +00:00
Ilya Chernikov deb2d6d024 K2 Scripting: enable K2 tests in some test projects 2022-12-21 14:34:21 +00:00
Ilya Chernikov 90a4f6002e K2 Scripting: support sam-with-receiver in scripting plugin 2022-12-21 14:34:21 +00:00
Ilya Chernikov 00a28f9f49 K2 Scripting: compiler extension for script configuration 2022-12-21 14:34:20 +00:00
Ilya Chernikov 337d11d4c8 K2 Scripting: enable K2 compilation in scripting plugin 2022-12-21 14:34:19 +00:00
Dmitriy Novozhilov c8b6e57c4d [Serialization] Use original name instead of SerialName for parameters of constructor 2022-12-21 11:09:31 +00:00
Dmitriy Novozhilov ce2880614b [FIR2IR] Run constant evaluation before IR extensions
Test `constValInSerialName` in serialization still fails but because of
  different reason

^KT-54994 Fixed
2022-12-21 11:09:30 +00:00
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +00:00
Dmitriy Novozhilov 4bddb27ca3 [FIR] Get rid of candidateSymbol in FirNamedReference
`candidateSymbol` has any reasonable meaning only for references with
  not completed candidate, so this property is moved from FirNamedReference
  to new node FirNamedReferenceWithCandidateSymbol, which has real
  implementation only in :resolve module (`FirNamedReferenceWithCandidate`)
2022-12-20 08:12:07 +00:00
Sergey.Shanshin 5e01669e23 Added saving SerialInfo annotations to the enum class
Resolves Kotlin/kotlinx.serialization#2121

Merge-request: KT-MR-8019
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2022-12-18 19:22:16 +00:00
Ilya Chernikov 88d140527f Scripting: optimize check for allowed scripts on init 2022-12-18 16:49:41 +00:00
Evgeniy.Zhelenskiy f6c63c6e4f [IR, Serialization] Support kotlinx-based (de)serialization of MFVC, nullable MFVC value assignment to nonnull variable
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-16 17:20:51 +01:00
Dmitriy Novozhilov 34be0f05b2 [FIR] Add utility for checking if FirReference is one of error reference
Also simplify relevant code in checkers
2022-12-15 12:12:21 +00:00
Dmitriy Novozhilov b53c4a6353 [FIR] Introduce some typed FirReference.toResolvedXXXSymbol utilities 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov cffc32ec76 [FIR] Fir utils for FirReference in package org.jetbrains.kotlin.fir.references 2022-12-15 12:12:20 +00:00
Dmitriy Novozhilov b174bb8844 [FIR] Update testdata after introducing FirResolvedErrorReference 2022-12-15 12:12:19 +00:00
Dmitriy Novozhilov dde64c10ea [FIR] Create FirResolvedErrorReference for error reference with single candidate
Note that this reference won't be created for hidden candidates,
  because they are designed to be truly invisible from the user side
2022-12-15 12:12:19 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Ilya Kirillov 644d1bf0d0 [FIR] ignore tests which fail because of resolve contracts violation 2022-12-12 16:21:07 +00:00
Ilya Kirillov 7bac119f20 [FIR] add lazy resolution contract checks in resolve 2022-12-12 16:21:06 +00:00
Leonid Startsev 1c4614e93b Handle situation where KSerializer is absent from immediate supertypes
of the class used in @UseSerializers: Use methods to receive
full list of supertypes.

K1 supertypes() call returned all supertypes, while
IrClass.supertypes and FirClassSymbol.resolvedSuperTypes return only immediate ones.

This lead to a difference in behavior between K1 and K2, and regression
after plugin backend was rewritten from descriptors to IR.

#KT-55340 Fixed
2022-12-08 12:15:16 +00:00
Leonid Startsev c011f0c374 Change throw AssertionError to error() that throws IllegalStateException
as ISE is more appropriate exception for validation.

Improve SerializerClassLowering.runPluginSafe so precise IrClass
where plugin have failed can be reported for non-fatal errors.

#KT-55296 Fixed
2022-12-08 12:15:16 +00:00
Alexander Udalov a594434a95 Kapt+JVM_IR: do not run IR plugins in kapt mode
Because in kapt stub generation mode (aka ClassBuilderMode.KAPT3, aka
generateBodies=false in psi2ir), method bodies are not generated and
compiler plugins such as kotlinx-serialization might not expect that.

 #KT-54245 Fixed
2022-12-07 21:14:30 +00:00
Alexander Udalov 5848b2fde6 Kapt+JVM_IR: add IrKotlinKapt3IntegrationTest 2022-12-07 21:14:29 +00:00
Alexander Udalov 60d96b7d15 Remove some leftover imports of unsafe cast functions 2022-12-06 19:44:56 +00:00
Alexander Udalov 0d8d91f803 Remove unsafe cast function usages from compiler plugins 2022-12-06 19:44:56 +00:00
Andrey Uskov 41ff283856 Don't call File.getCanonicalPath in KGP
Relates to KT-54579.
2022-12-04 18:49:30 +00:00
Andrey Uskov ca8f234f28 Improve performance of KAPT on JDK 17
Getting canonical path is expensive on JDK 17, thus check, whether
file is belongs to some folder becomes expensive.
In this commit implementation was replaced to a new one based on
File.getParent. It gives profit 49seconds-> 500 ms/100k files.
Note! Now if there are present two files which are actually links of the
same file, they are treated as two different files.
#KT-54579 Fixed
2022-12-04 18:49:30 +00:00
Mikhail Glukhikh 900a3e59ff AndroidPackage...Extension: make createLazyValue result not null 2022-12-02 15:42:37 +00:00
Leonid Startsev ee9d9d7b32 Do not pre-generate writeSelf function for non-JVM platforms
write$Self in K1 is created only on JVM, so we need this check to avoid
creating IR function without original descriptor — it will lead to various
bugs in JS and Native, such as superclass properties missing from output
when super.writeSelf is not found in descriptor.

Fixes #KT-55180
2022-12-01 16:16:38 +00:00
Vyacheslav Gerasimov 50ad5027fe Build: Fix kotlin-annotation-processing pom dependencies
#KTI-878
2022-12-01 15:50:38 +01:00
Dmitriy Novozhilov fe81ad0bbe [Build] Fix configuration cache issues of miscCompilerTests 2022-12-01 07:29:40 +00:00
Dmitriy Novozhilov 6864433581 [FIR] Support resolution of meta-annotations before supertypes
Now annotations are resolved with following algorithm:
1. On COMPILER_REQUIRED_ANNOTATIONS we resolve all annotations
     and store results if this is compiler annotation, plugin annotation,
     or annotation with meta-annotation (meta annotations are checked
     recursively with designated resolution if needed)
2. On TYPES stage we resolve all those annotations once again and if
     some annotation changes resolution then we keep type from p.1 and
     report error on this annotation, so user should disambiguate it

Ambiguity may occur because of nested annotations with same name as
  plugin annotations:

```
annotation class SomeAnnotation // (1) plugin annotation

open class Base {
    annotation class SomeAnnotation // (2)
}

class Derived : Base() {
    @SomeAnnotation // <-----------------
    class Inner
}
```
At COMPILER_REQUIRED_ANNOTATIONS annotation call will be resolved to (1)
  because at this stage supertypes are not resolved yet, and we consider
  only importing scopes. At the TYPES stage we will find correct
  annotation from supertype
2022-12-01 07:29:39 +00:00
Dmitriy Novozhilov 6a9b525ca0 [Serialization] Fix dependency on kotlin-reflect 2022-12-01 07:29:38 +00:00
Dmitriy Novozhilov 0b4216c096 [FIR] Fix test configuration of FIR plugin prototype 2022-12-01 07:29:38 +00:00
Dmitriy Novozhilov 8436328bb5 [ImportsDumper] Fix path replacements in tests on Windows 2022-12-01 07:29:37 +00:00
Dmitriy Novozhilov 6b343515e1 [Test] Save IR bytecode dumps from BytecodeListingHandler to .ir.txt file instead of _ir.txt
This is needed to keep consistency with other dumps and to allow
  test helper plugin to recognize those dumps
2022-12-01 07:29:37 +00:00
Dmitriy Novozhilov 246dc985a6 [FIR] Rework predicates system
Now predicates are split into LookupPredicate and DeclarationPredicate
  hierarchies. First one allows to perform global search for declarations
  and second one allows to check if some declaration matches the predicate.
Predicates with meta annotations are excluded from LookupPredicates,
  because it's impossible to create index of annotations with meta-annotations,
  because they can be located inside binary dependencies (so to achieve
  this we need to scan the whole classpath).
Also only one predicate with meta-annotations is left in DeclarationPredicate
  hierarchy (AnnotatedWithMeta)

^KT-53874 Fixed
^KT-53590 Fixed
2022-12-01 07:29:37 +00:00
Dmitriy Novozhilov 7a9a71a089 [ImportsDumper] Add missing test runtime dependencies 2022-12-01 07:29:36 +00:00
Dmitriy Novozhilov 2610ad94e0 [SamWithReceiver] Fix test configuration and testdata 2022-12-01 07:29:36 +00:00
Dmitriy Novozhilov ebc879ed1e [AllOpen] Update testdata 2022-12-01 07:29:36 +00:00
Dmitriy Novozhilov 700a117476 [Build] Add forgotten compiler plugins tests to aggregate build 2022-12-01 07:29:35 +00:00
Alexander Udalov 25c5ad176c Minor, update instructions for installing protobuf261 + regenerate 2022-12-01 01:37:55 +01:00
Evgeniy.Zhelenskiy fa4ceb4ef4 [IR] Add diagnostics to forbid annotations for MFVC-typed elements
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:39 +00:00
Mads Ager 30002e29d1 [KAPT+JVM_IR] Do not generate initializers for delegated properties.
^KT-54870 Fixed
2022-11-28 22:27:09 +01:00
Sergey.Shanshin 339b152390 Implemented caching of child serializers
Resolves Kotlin/kotlinx.serialization#1918

Merge-request: KT-MR-7578
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2022-11-23 19:53:44 +00:00
Nikolay Lunyak 4b3dc008f0 [FIR] KT-54260: Fix the compiler crash
AllOpen plugin makes the properties all-open, but the annotation class
is left closed, because allopen for k2 literally checks
`classKind == CLASS`.

Since the properties are open, a
`NON_FINAL_MEMBER_IN_FINAL_CLASS` diagnostic is reported for them. It's
positioning strategy seeks for the explicit `open` modifier which is
not present.

The added test should not crash the compiler.

^KT-54260 Fixed
2022-11-22 20:25:38 +00:00
Ilya Kirillov 7781ad67d4 [FIR] introduce FirValueParameter.containingFunctionSymbol
^KT-55034 fixed
2022-11-22 18:25:30 +01:00