Commit Graph

72940 Commits

Author SHA1 Message Date
Stefan Wolf 200ef832d2 Add PathSensitive annotation to all input file properties
So new validation which will be added in Gradle 7.1
won't cause warnings during the build.
2021-02-23 23:26:39 +03:00
Stefan Wolf 8b01df6772 Enable stricker Kotlin Gradle Plugin validation 2021-02-23 23:26:35 +03:00
Mads Ager 8852323a76 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.
2021-02-23 19:33:49 +01:00
Ilmir Usmanov d44799fa78 JVM IR: Use INVOKESPECIAL instead of INVOKEVIRTUAL for default private
suspend functions.

 #KT-26592
2021-02-23 18:49:10 +01:00
Ilmir Usmanov 3ee62cb1b2 JVM IR: Do not generate private suspend functions as synthetic package-private
#KT-26592
2021-02-23 18:49:06 +01:00
Alexander Udalov 48fb085bf6 Deprecate kotlin.Metadata.bytecodeVersion
#KT-41758 Fixed
2021-02-23 12:45:41 +01:00
Alexander Udalov f63ffc51ae Remove JvmBytecodeBinaryVersion from the compiler code
Move it to build-common where it's still used in incremental compilation
caches, and simplify a bit. In the future, it'll make sense to remove it
completely and to avoid writing it to caches. In this commit, I don't do
that to prevent the IC cache version to be updated, causing rebuilds for
all JPS projects.

 #KT-41758
2021-02-23 12:45:41 +01:00
Alexander Udalov d300e05be9 Remove obsolete code in inliner for experimental coroutines 2021-02-23 12:45:41 +01:00
Alexander Udalov 448c6c2f0d kotlinx-metadata-jvm: deprecate KotlinClassHeader.bytecodeVersion
#KT-41758
2021-02-23 12:45:40 +01:00
Alexander Udalov c6f5ce6837 Do not write bytecode version to class file
#KT-41758
2021-02-23 12:45:40 +01:00
Alexander Udalov 862a9143da Do not report errors about bytecode version
#KT-41758
2021-02-23 12:45:40 +01:00
Dmitriy Dolovov fa2b2c8735 [Commonizer] Make CirProperty.compileTimeInitializer non-nullable
There is effectively no difference between null and CirConstantValue.NullValue recorded in compileTimeInitializer.
2021-02-22 21:06:49 +03:00
Dmitriy Dolovov b3e68d3704 [Commonizer] Make CirProperty.[backing|delegate]FieldAnnotations non-nullable
There is effectively no difference between missing field and a field with no annotations.
2021-02-22 21:06:41 +03:00
Dmitriy Dolovov 215dd8515b Minor. Remove compilation warning 2021-02-22 21:06:34 +03:00
Toshiaki Kameyama ee406f1622 Lift assignment out: if last statement is lambda, enclose it in parentheses if necessary
#KT-38155 Fixed
2021-02-22 17:40:06 +01:00
Alexander Udalov e6476c39ca JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed
2021-02-22 12:52:48 +01:00
Aleksandr Liublinskii 08cf78fafd MI-141 Fix 'Empty Library' entry in module dependencies 2021-02-22 12:25:47 +01:00
Alexander Udalov eec98314c8 Revert "Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern."
This reverts commit 073a500370.
2021-02-22 10:14:32 +01:00
Pavel Punegov 073a500370 Change order of WITH_RUNTIME and FILE. Wrong order brakes module pattern. 2021-02-21 11:12:33 +03:00
Pavel Punegov 95a8c60a9c Ignore test in Native backend. Test overrides kotlin.Result 2021-02-21 11:11:46 +03:00
Pavel Punegov 4643f12a5f Ignore JVM test in Native backend 2021-02-21 11:11:46 +03:00
Ilya Goncharov d9be59ea97 [JS IR] JS code in init block only for js ir backend test 2021-02-20 21:06:28 +03:00
Dmitriy Novozhilov 13dfa5a886 [FIR2IR] Add handling exceptions from Fir2Ir and reporting declaration where converter failed 2021-02-20 18:27:45 +03:00
Dmitriy Novozhilov ea2783eace [FIR] Fix generating this reference in delegated accessors
There was a problem with delegated extension property with dispatch
  receiver that `this` in `getValue` call was set to dispatch receiver
  instead of extension one
2021-02-20 18:27:43 +03:00
Victor Petukhov 4e5647090e Approximate captured types in contravariant positions properly
^KT-43802 Fixed
2021-02-20 16:57:07 +03:00
Dmitry Petrov 387d84f826 JVM_IR indy-SAM: KT-45069 box lambda 'Unit' return type if needed 2021-02-20 15:07:24 +03:00
Ilya Goncharov 187d4998fa [JS IR] Not cast to declaration parent in JsCodeOutlineLowering, use parent otherwise
^KT-45057 fixed
2021-02-20 13:08:45 +03:00
Ilya Goncharov bd2601f289 [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed
2021-02-20 12:05:06 +03:00
Mikhail Glukhikh 5568ceef68 Add test for KT-37056 (already fixed) 2021-02-20 11:37:34 +03:00
Mikhail Glukhikh 6e46b0a1c4 Add test for KT-41917 (already fixed) 2021-02-20 11:37:33 +03:00
Denis.Zharkov 1fe0a1f160 FIR: Fix interface delegation case via type alias 2021-02-20 10:59:23 +03:00
Denis.Zharkov e4c851e3ce FIR2IR: Fix case of @JvmOverloads with subclass
Avoid generating synthetic overrides in subclass
It has been already working for PSI2IR because fake overrides there don't
inherit default values for parameters, while they do it in FIR
2021-02-20 10:59:22 +03:00
Denis.Zharkov 377a0aa237 FIR2IR: Adjust test data for updated overridden structure 2021-02-20 10:59:22 +03:00
Denis.Zharkov a750d9466e FIR2IR: Rework resulted overridden-relation structure
The difference is how we deal with intermediate fake overrides
E.g., in case

interface A { /* $1 */ fun foo() }
interface B : A {
     /* $2 */ fake_override fun foo()
}
interface C : B {
   /* $3 */ override fun foo()
}

We've got FIR declarations only for $1 and $3, but we've got
a fake override for $2 in IR.

Previously, override $3 had $1 as its overridden IR symbol, just because
FIR declaration of $3 doesn't know anything about $2.

Now, when generating IR for $2, we save the necessary information
and using it for $3, so it has $2 as overridden.

So, it's consistent with the overridden structure of FE 1.0 and this
structure is necessary prerequisite for proper building of bridges
for special built-ins.
2021-02-20 10:59:22 +03:00
Denis.Zharkov fd146e3eed FIR2IR: Copy annotations from original declarations to fake overrides 2021-02-20 10:59:22 +03:00
Denis.Zharkov a883833941 FIR2IR: Use IrDeclarationOrigin.FAKE_OVERRIDE for non-source classes 2021-02-20 10:59:21 +03:00
Denis.Zharkov d339096ac3 FIR2IR: Introduce and use declarationStorage.getOrCreateIrConstructor
It's necessary because constructors of LazyIrClass annotations may be
referenced before members are processed
2021-02-20 10:59:21 +03:00
Denis.Zharkov fb8314f6e7 FIR: Fix enhancement of property overrides accessors in Java 2021-02-20 10:59:21 +03:00
Denis.Zharkov 45018ea468 FIR: Rework loading overrides of special built-in methods from Java
Some of the changed data is correct, but some diagnostics are incorrect
Corner cases like having both contains(Object) and contains(String)
within implementation of Collection<String> is not supported
2021-02-20 10:59:21 +03:00
Denis.Zharkov 4b0aeb7105 FIR2IR: Support initialSignatureDescriptor
It will be used for overrides of renamed special built-ins during signature mapping
to obtain initial signature
2021-02-20 10:59:21 +03:00
Denis.Zharkov 23705a269f FIR: Fix supertype scopes for local classes
Do not use ClassId as it can't be a key for local classes
2021-02-20 10:59:21 +03:00
Denis.Zharkov 3e420ca4e3 FIR: Introduce FirDeclarationOrigin.BuiltIns 2021-02-20 10:59:21 +03:00
Denis.Zharkov 893b1045ba Move some common parts from BuiltinMethodsWithDifferentJvmName to SpecialGenericSignatures 2021-02-20 10:59:21 +03:00
Denis.Zharkov 5d5228cfc5 FIR: Require FirJavaClass in JavaScopeProvider 2021-02-20 10:59:20 +03:00
Denis.Zharkov 04f53d6a23 FIR: Simplify JavaScopeProvider
::wrapScopeWithJvmMapped is only needed for built-in classes defined in Kotlin
2021-02-20 10:59:20 +03:00
Denis.Zharkov 6766c8fe47 FIR: Simplify supertypes scopes computation 2021-02-20 10:59:20 +03:00
Denis.Zharkov 31b9be2d01 FIR: Extract ConeKotlinType::scopeForSupertype 2021-02-20 10:59:20 +03:00
Mikhail Glukhikh 1a0be3ee40 Fix FirAnnotationArgumentChecker (String + ... case) #KT-44995 Fixed 2021-02-20 10:31:26 +03:00
Dmitriy Novozhilov cd8f597e2f [FIR] Fix building callable reference adaptation against flexible types
#KT-45052 Fixed
2021-02-20 10:23:34 +03:00
Dmitriy Novozhilov 469252f6b4 [FIR] Don't create smartcast node if smartcasted type is equal to original type 2021-02-20 10:23:33 +03:00