Commit Graph

987 Commits

Author SHA1 Message Date
Mads Ager 87f17dec4a [JS_IR] Use IrSetValue for default argument handling for JS backend.
Fix a couple of parameter remappings that now have to take IrSetValue
into account as well as IrGetValue.
2020-10-06 21:47:29 +02:00
Mads Ager 9a93bb3f09 [IR] Add IR support for setting parameters.
Use it in the JVM_IR backend for default values code. The parameter
local has to be overwritten for the inliner to work.
2020-10-06 21:47:29 +02:00
Mads Ager a37f16d7a2 [IR] Do not generate line numbers for synthesized data class members.
Fixes KT-41903.
2020-10-06 19:53:47 +02:00
Steven Schäfer 714d17ac63 Parcelize, JVM IR: Handle star projected and nullable arrays. 2020-10-06 17:42:35 +02:00
Alexander Udalov 2573eaa77f IR: do not crash renderer on functions with uninitialized return type
This is a follow-up to b497f39c29. It
turns out that it didn't help because `IrFunction.returnType` throws
exception, and checking for `IrUninitializedType` in `IrType.render` was
already too late. Throw and catch specific exception instead.

Also add function name into the exception message for better diagnostics
elsewhere (can't compute the full FQ name because in cases like
KT-42020, the parent is also uninitialized).
2020-10-06 14:23:34 +02:00
Alexander Udalov 06f1bd6101 Reformat IR tree declarations and implementations
Most of the changes are to the incorrect formatting introduced in
d1fd1da56f.
2020-10-06 14:21:40 +02:00
LepilkinaElena 402f7df0d4 [IR] Save several last calculated line numbers not to recalculate them several times during code and debug info generation (#3792) 2020-10-06 08:03:50 +03:00
LepilkinaElena dc2845df10 [IR] Avoid extra lists creation during getting explicit/all parameters (#3769) 2020-10-01 21:19:40 +03:00
Dmitry Petrov af86c52101 JVM_IR merge annotations when substituting types
Otherwise special annotations such as @EnhancedNullability are lost,
which affects JVM signatures.

KT-42330
2020-09-30 15:44:54 +03:00
Alexander Udalov b497f39c29 IR: do not try to render IrUninitializedType
This will improve exception messages in case some error happens on a
function whose return type is uninitialized, as in KT-41401.
2020-09-29 12:32:45 +02:00
Georgy Bronnikov 83ee705c0a IR: make IrClassReference.classType mutable 2020-09-22 23:53:41 +03:00
Georgy Bronnikov 377940a6ea IR: handle IrVararg.varargElementType in RemapTypes 2020-09-22 23:53:41 +03:00
Georgy Bronnikov 728c55973a IR: handle MemberAccessExpression type parameters in RemapTypes 2020-09-22 23:53:41 +03:00
Georgy Bronnikov 3041a2815c IR: handle varargElementType in LocalDeclarationsLowering 2020-09-22 23:53:41 +03:00
Georgy Bronnikov 67d7bf3269 IR: take care of supertypes when copying IrTypeParameters 2020-09-22 23:53:40 +03:00
Georgy Bronnikov 1f3d344835 IR: add RemapTypes.kt 2020-09-22 23:53:39 +03:00
Georgy Bronnikov df1d9a0113 IR: make IrTypeParameter.superTypes persistent mutable field 2020-09-22 23:53:39 +03:00
Georgy Bronnikov a409976d28 IR: make IrValueParameter.varargElementType mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov a3763e8276 IR: make IrTypeAlias.expandedType mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov 78fc690f29 IR: make IrLocaldelegatedProperty.type mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov 09a906cc9a IR: make IrTypeOperatorCall.typeOperand mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov d9681e535d IR: make IrField.type mutable 2020-09-22 23:53:39 +03:00
Georgy Bronnikov 5065b1a4c6 Make IrValueDeclaration.type mutable 2020-09-22 23:53:38 +03:00
Georgy Bronnikov 1f37795e08 IR: make IrExpression.type mutable 2020-09-22 23:53:38 +03:00
Mads Ager 78483930bc [JVM_IR] Fix offsets in constant propagation optimization.
Loads of temporary variables that contain constants are replaced
with a copy of the constant. This avoids locals loads and stores.
However, the copy of the constant needs to have the offset of
the load and not of the original constant.

Fixes KT-41963.
2020-09-22 19:12:06 +02:00
Dmitry Petrov c03573fc18 JVM_IR fix override equivalence check for collection stub generation
KT-42043 KT-42033
2020-09-22 15:26:34 +03:00
Georgy Bronnikov 8343ca093c IR: bugfix in wrapped, IR-based descriptors 2020-09-17 19:16:03 +03:00
Georgy Bronnikov 3c0fbd5f45 IR: remove .toKotlinType() usage from coerceToUnit calls in lowerings 2020-09-17 19:16:03 +03:00
Roman Artemev 4da7e762fe [IR] Skip hidden parameters in WrappedDescriptors 2020-09-17 00:57:17 +03:00
Roman Artemev 1da2830e2b [IR] Support hidden parameters in ir builder 2020-09-17 00:57:16 +03:00
Roman Artemev f01941d1dd [IR] Support isHidden is IrFactory API
- add API to create a hidden value parameter
2020-09-17 00:57:16 +03:00
Roman Artemev 79e2886da1 [IR] Add isHidden flag into IrValueParameter 2020-09-17 00:57:15 +03:00
pyos a06181771f IR: make DescriptorMetadataSource a subtype of MetadataSource
FirMetadataSource is a metadata source too.
2020-09-16 18:58:40 +02:00
Alexander Udalov fc141a52da IR: minor, make IrClass.companionObject return IrClass 2020-09-13 09:13:26 +02:00
Alexander Udalov 2f86554d5a IR: don't produce fake overrides for static and private declarations
Note that only irrelevantStaticProperty.kt failed before this change.
Having private declarations caused no problems, but it seems incorrect,
so it's fixed now and irrelevantPrivateDeclarations is added just in
case.

 #KT-41848 Fixed
2020-09-12 20:01:34 +02:00
Georgy Bronnikov 92b03e7ede JVM_IR: Remove descriptor usage from IrSourceCompilerForInline 2020-09-12 12:59:03 +03:00
Alexander Gorshenev 744f290fc4 A proper modality calculation was missing in IR fake override construction algorithm
#KT-41765 Fixed
2020-09-11 18:56:17 +03:00
Igor Chevdar e39ce91253 [IR] Fixed fake override builder for lowerings 2020-09-11 09:35:01 +05:00
Steven Schäfer 44ffb1fb3e Psi2Ir: Fix SAM conversion with new inference 2020-09-08 11:14:14 +03:00
pyos f198a19ab0 FIR2IR: add local delegated property generation 2020-09-08 08:40:07 +03:00
Dmitry Petrov 5b53663eb8 PSI2IR KT-41181 don't generate deep trees in hashCode 2020-09-07 16:09:42 +03:00
Dmitriy Novozhilov d1fd1da56f Rename Visibility to DescriptorVisibility 2020-09-04 11:07:42 +03:00
Dmitry Petrov 475522f938 Represent raw types in IR using a special type annotation 2020-09-04 10:21:48 +03:00
Dmitry Petrov 714ab7c37f Handle java raw types in IR
Raw type Q is represented as a flexible type
  Q<B1, ... Bn> .. Q<*, ... *>
where Bi is a representative upper bound of the corresponding ith type
parameter of Q.
When mapping generic signature, JVM takes type arguments of lower bound
(which is 'Q<B1, ..., Bn>').

There is still some difference in how JVM and JVM_IR handle raw type in
signature. It requires additional investigation.
2020-09-04 10:21:48 +03:00
Roman Artemev fdbc657656 [IR] Fix isFileClass checker 2020-09-01 18:53:17 +03:00
Roman Artemev cae29a5d1c [IR] Clean up WrappedDescriptors API 2020-09-01 17:08:11 +03:00
Roman Artemev c7b57c0fb3 [IR] Use only empty constructor to create WrappedDescriptor 2020-09-01 17:08:11 +03:00
Roman Artemev fd88914cf9 [IR] Remove some descriptor usage from Common/JS/JVM backends
- replace descriptor-based builders with pure IR ones
 - fix matchers
 - fix Ir2Js
 - rewrite some inliner-helpers to pure-IR implementations
2020-09-01 17:08:11 +03:00
Dmitry Petrov 8cb8284957 EnhancedNullability annotation in IR
Fixes KT-40115 & KT-40117.

Move FlexibleNullability annotation to 'kotlin.internal.ir'.
2020-09-01 16:06:03 +03:00
Dmitriy Novozhilov f010dc533c Move Variance.convertVariance to :core:compiler.common 2020-09-01 12:00:11 +03:00