Commit Graph

91086 Commits

Author SHA1 Message Date
Mads Ager 66bf5b08ba Allow versionNeededToExtract between 0 and 20 in Zip impl.
In the Android eco-system, there are jars with entries with a
versionNeededToExtract of 0. That should probably have been 10,
but will be hard to fix. This change proposes to just check
that the versionNeededToExtract is between 0 and 20.
2022-02-09 13:01:12 +03:00
Svyatoslav Scherbina 76672a4abf Native: terminate if cinterop ObjC reference conversion throws exception
To avoid forwarding Obj-C exceptions to Kotlin or vice versa.
Otherwise this might lead to a crash or other undesirable behaviour.

^KT-50648 Fixed
2022-02-09 07:47:42 +00:00
Svyatoslav Scherbina d235fc4dbe Native: add thread state switches to blockToKotlinImp 2022-02-09 07:47:42 +00:00
Svyatoslav Scherbina 925e7801aa Native: improve message when Obj-C block can't be converted to Any 2022-02-09 07:47:41 +00:00
Denis.Zharkov baa287d6ee Unmute previously failing piece of test at definitelyNotNullAsArgument.kt
^KT-49419 Obsolete
2022-02-09 00:30:53 +03:00
Alexander Udalov 032d69aa41 Kapt: handle special names correctly
Parameter names of some methods are different in JVM IR, for example
extension receivers of property `$annotations` methods are named
`<this>`, which made the `Name.identifier` call fail. It seems fine to
use the "p + index" name for this instead.

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov 07d3e3a5bd Kapt: support property $annotations methods for JVM IR
`is PropertyDescriptor` check doesn't work for JVM IR where descriptor
is created on-the-fly and is an `IrBasedSimpleFunctionDescriptor`.

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov 25edf64daf Psi2ir: support mode without generation of bodies
This is needed for kapt + JVM IR.

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov b3820564b0 Kapt: never generate enums as final
Behavior differs between JVM and JVM_IR backends here because in JVM,
the class descriptor comes from the frontend, and its modality for enum
is never final. For JVM IR, the class descriptor is based on IrClass,
whose modality is sometimes final for enum, presumably because it's
easier for backends (see `ClassGenerator.getEffectiveModality`).

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov fc2c0eea27 JVM IR: generate source-retained annotations in kapt mode
#KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov 1df2851611 IR: use names $this/$receiver for receivers in copied static functions
Similarly to the other places in the IR backend (e.g. see
`copyValueParametersToStatic` in the same file).

In JVM IR, these names are used for example for receiver parameters of
methods copied to DefaultImpls classes. Since Java stub code generated
by kapt mentions them, it fixes a few issues in tests on kapt + JVM IR
(KT-49682).
2022-02-08 20:15:13 +01:00
Alexander Udalov f6d3bb5b1b Kapt: add JVM IR expectations for some tests
All of these have a different order of declarations and/or extra
`@NotNull` annotations on fields, both of which doesn't seem like a
problem.

 #KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov bcd221f714 Kapt: use descriptorBasedTypeMapping for type mapping
Since all anonymous types are approximated to a supertype in kapt, type
mapping doesn't require backend information (mapping of anonymous types
to class names) and can be performed statically, independently from
particular JVM backend internals, via descriptorBasedTypeMapping.

 #KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov 754ad100a9 Minor, cleanup kapt tests
Fix inspections, reformat
2022-02-08 20:15:13 +01:00
Alexander Udalov 62c1c33ee3 Kapt: slightly improve CustomJdkTestLauncher
- Include stdout & stderr dump to the exception message if the Java
  command fails
- Support running JVM_IR tests
- Do not print anything to the stdout of the test itself in case it's
  successful

 #KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov ebb9659e03 Add mode to run kapt with JVM IR, use in tests
Currently JVM IR is not supported in kapt, so almost all tests are
failing, and thus are muted with IGNORE_BACKEND.

 #KT-49682
2022-02-08 20:15:13 +01:00
nataliya.valtman d089d27bef Add proper kotlin version into http reports 2022-02-08 16:24:15 +00:00
Svyatoslav Scherbina cd62b5b3b3 ObjCExport: optimize receiving autoreleased references from Obj-C/Swift
when the callee supports this.
2022-02-08 15:17:06 +00:00
Svyatoslav Scherbina 874cc6c51c Native: add LLVMSetNoTailCall to LLVM C API 2022-02-08 15:17:05 +00:00
Svyatoslav Scherbina 085e2448cd ObjCExport: don't use autorelease when sending arguments to Swift/Obj-C 2022-02-08 15:17:04 +00:00
Svyatoslav Scherbina 9326978327 ObjCExport: fix noAutorelease tests for the new MM 2022-02-08 15:17:04 +00:00
Svyatoslav Scherbina d161108be3 ObjCExport: fix noAutorelease/testReceiveBlockFromSwiftAndCall
The test expects to track block result lifetime in Swift, so we should
add it to the tracker.

Also fix the same problem for testReceiveBlockFromKotlinAndCall
(which didn't fail because we added the block itself to the tracker).
2022-02-08 15:17:04 +00:00
Hung Nguyen d018031cbf KT-45777: Clean up build cache tests for incremental compilation
- Clean up BuildCacheRelocationIT.testKotlinIncrementalCompilation
 - Delete BuildCacheIT.testKotlinCompileIncrementalBuildWithoutRelocation
   as it is already covered by the test in BuildCacheRelocationIT
 - Add BuildCacheRelocationIT.testKotlinIncrementalCompilation_withClasspathSnapshot
- Updated BuildCacheRelocationIT.testKotlinIncrementalCompilation_withClasspathSnapshot
2022-02-08 18:07:38 +03:00
sebastian.sellmair 200cc9f75f [Gradle][MPP] Disabled CInteorp warning: Show cinterops instead of compilations
KT-51176
2022-02-08 09:22:15 +01:00
sebastian.sellmair 56de13fe2f [Gradle][MPP] Show (potential) warning on disabled cinterop commonization
^KT-51176 Verification Pending
2022-02-08 09:22:15 +01:00
Roman Golyshev 42010282d5 [FIR IDE] Use correct extension receiver FIR expression in completion
`getOrBuildFir` does not record `FirCheckedSafeCallSubject`
expression, and it would be impossible to get them anyway
since there are no PSI corresponding to "not null receiver"
in expressions like `foo?.bar` - there is only `foo`,
which is considered nullable by FIR

`FirCheckedSafeCallSubject` wrapper has non-null type during
resolve, and it becomes very important in
`KtFirCompletionCandidateChecker`. If we loose the wrapper,
then it would be impossible to call extensions on nullable
types using `?.` syntax

^KTIJ-21021 Fixed
2022-02-07 22:06:28 +00:00
Ivan Kochurkin f32c355190 [FIR] Correct resolving of sam with suspend function from another module, ^KT-51007 Fixed
Ignore fir ide test probably because of KT-50732
2022-02-07 17:22:02 +03:00
Ivan Kochurkin 17c64cf955 [FIR] Add INV to UNARY_OPERATION_NAMES, ^KT-50998 Fixed 2022-02-07 17:22:02 +03:00
Ivan Kochurkin 30871fc08f [FIR] Infer labeled type for lambda in return in catch ^KT-51009 Fixed 2022-02-07 17:22:01 +03:00
Ivan Kochurkin d82dff0e75 [FIR] Refactor findMaximallySpecificCall
Remove generic and function arguments from methods
2022-02-07 17:22:01 +03:00
Ivan Kochurkin 635166c969 [FIR] Get rid of excess allocations in FlatSignature 2022-02-07 17:22:00 +03:00
Ivan Kochurkin a0510f4a67 [FIR] Fixed Replace ConeTypeVariable on ConeTypeParameter ^KT-51017
in AbstractConeCallConflictResolver.computeParameterTypes
2022-02-07 17:21:59 +03:00
Ivan Kochurkin 5391ee91af [FIR2IR] Fix incorrect type of typealias for suspend functional type, ^KT-50997 Fixed 2022-02-07 17:21:59 +03:00
Ivan Kochurkin 828c442518 [FIR] Fix TYPE_VARIANCE_CONFLICT location for function type with receiver
It should be covered by an example from KT-50947
2022-02-07 17:21:58 +03:00
Ivan Kochurkin 8a8bdc9ff4 [FIR2IR] Fix synthetic property reference in delegate expression 2022-02-07 17:21:58 +03:00
Mads Ager a398f7d6cb Rename kt-reference module to kt-references. 2022-02-07 15:01:24 +01:00
Mads Ager 17aee1e944 Move frontend independent parts of KtReference.isReferenceTo up to share it. 2022-02-07 15:01:24 +01:00
Mads Ager 6f0bb0eda5 Add analysis:kt-reference module and move KtReferences there. 2022-02-07 15:01:23 +01:00
Yahor Berdnikau 5320a32d67 Check also the cause of throwable for OOM exception
Sometimes OOM exception is the cause of some higher-level one
exception in compilation.

^KT-51116 Fixed
2022-02-07 13:59:48 +00:00
Dmitriy Novozhilov 5b79279590 [Test] Add test data of raw FIR tests to Test Helper Plugin paths 2022-02-07 16:17:37 +03:00
Ilya Goncharov 77b367fe96 rra/ilgonmic/ic-to-compiler
[JS IR] Fix compilation in tests

[JS IR] Fix test after migrating IC to compiler

[JS IR] Fix memory leak

[JS IR] Move js ic to compiler

Merge-request: KT-MR-5673
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2022-02-07 11:40:16 +00:00
Dmitriy Novozhilov aadfc59d0f [FIR] Complete delegated constructor calls without proper constructed type
This is needed to definitely complete arguments of such calls
2022-02-07 13:36:38 +03:00
Dmitriy Novozhilov 1591518cf6 [FIR] Support constant unary operators for integer literal operators
^KT-38895
2022-02-07 13:36:37 +03:00
Dmitriy Novozhilov 52b72a7dac [FIR] Implement Int -> Long conversions for literals and operators over them
^KT-38895
^KT-50996 Fixed
^KT-51000 Fixed
^KT-51003 Fixed
^KT-51018 Fixed
2022-02-07 13:36:36 +03:00
Dmitriy Novozhilov cc86ca2a0f [FIR] Extract common code for converting unaryMinus call on integer literal 2022-02-07 13:36:36 +03:00
Dmitriy Novozhilov 563e649ac3 [FIR] Introduce special ReceiverResolution resolution mode for resolution of receivers of calls
This resolution mode is needed to determine do we need approximate
  integer operator calls or not
2022-02-07 13:36:35 +03:00
Dmitriy Novozhilov b980f5ab32 [FIR] Introduce new kind of integer literal types for constant operator calls 2022-02-07 13:36:35 +03:00
Dmitriy Novozhilov bb5217be72 [FIR] Don't create ILT for integer literal if its value don't fit to Int type 2022-02-07 13:36:34 +03:00
Dmitriy Novozhilov 10c38ba47c [FIR] Reorganize cone type utilities
Make some overrides of members of Cone types final
2022-02-07 13:36:34 +03:00
Dmitriy Novozhilov 0bd3e8f418 [FIR] Rename ConeClassErrorType to ConeErrorType, drop ConeKotlinErrorType alias 2022-02-07 13:36:33 +03:00