Commit Graph

2881 Commits

Author SHA1 Message Date
Evgeniy.Zhelenskiy f05c972efb [K2, CLI] Support endOffset in Kotlin CLI
Duplicated messages in testdata appeared because default renderer
renders diagnostic spans ambiguously. It shows only start position.
In fact, there are 3 failures, 2 of them distinguish only by the
diagnostic end offset. See youtrack for more information.

The issue about inconvenient rendering is KT-64989.

#KT-64608
2024-02-05 13:26:13 +00:00
Alexander Udalov eeef70b2c8 Tests: remove TargetBackend.JVM_OLD
TargetBackend.JVM is equivalent to it at this point.
2023-07-17 16:55:24 +00:00
Mikhail Glukhikh 0c4a0360ac Deserialization/class reading: pass chosen JvmMetadataVersion whenever possible 2023-01-16 18:16:07 +01:00
Ilya Chernikov 07af2d807a Scripting, tests: enable custom script tests with IR 2022-12-11 09:08:54 +00:00
Vsevolod Tolstopyatov b29309478e Take into account 'KTypeImpl.classifier' in its hashCode and equals
Since KT-53308, we started to cache results of typeOf invocation
in reflection. The cache uses the origin 'KClassifier' as a key with
an optional list of 'KTypeProjection' in type argument position,
and computed result as a value.

Without classifier check, the caching produces incorrect execution in
a very specific classloaders usage which is leveraged
by IDEA source-tree:

* All Kotlin stdlib and reflect classes are always loaded by the same
  classloader
* Other classes that depend on Kotlin are loaded by separate
  classloaders

The reproducer:

* Attempt to use typeOf<kotlin.List<Foo>> from one classloader caches
  the resulting KType
* Attempt to use typeOf<kotlin.List<Foo>> from another classloader
  for the same 'Foo' that differs only in classloader reuses the
  computed KType, meaning that KType type argument classifier
  is simply incorrect and points to the 'Foo' from the first classloader

#KT-54611 Fixed
#KT-54629 Fixed

Merge-request: KT-MR-7470
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-10-24 19:05:08 +00:00
Mikhail Glukhikh 113d2653aa Drop deprecated -Xexperimental flag from compiler and tests 2021-07-14 21:18:23 +03:00
Mikhael Bogdanov be9ef8f3c8 Remove obsolete DxChecker 2021-01-29 17:47:37 +01:00
Dmitriy Novozhilov f61a318c9d [Test] Migrate AbstractBytecodeTextTest to new test infrastructure 2021-01-25 17:11:21 +03:00
Dmitriy Novozhilov 8689fc43cd [Test] Move java generation utils to :compiler:tests-compiler-utils module 2020-12-24 14:58:02 +03:00
Dmitriy Novozhilov c8f3a4802e [TEST] Introduce test-infrastructure-utils module and extract common test utilities here 2020-12-16 19:52:22 +03:00
Denis.Zharkov 1d873a1a73 Move earlier generated tests
^KT-43677 In Progress
2020-12-09 16:47:22 +03:00
Denis.Zharkov 1b575d7903 Add initial support for @JvmRecord in backend
- Write relevant class files attributes
- Emit property accessors with records-convention: propertyName -> propertyName()

^KT-43677 In Progress
2020-12-09 16:47:21 +03:00
Denis.Zharkov 059e2aab7a Make BlackBox tests for Java 9 generated 2020-12-09 16:29:03 +03:00
Denis.Zharkov 5d05419016 Add simple JDK15 BlackBox test
^KT-43677 In Progress
2020-12-09 16:29:03 +03:00
Dmitriy Novozhilov 1ee38286a8 [TEST] Move generated compiler tests to test-gen directory 2020-11-27 12:55:45 +03:00
Dmitry Petrov ee1e05fedd KT-42151 fix type arguments in local class constructor reference types 2020-11-26 18:40:49 +03:00
Ilmir Usmanov 9ed5b8f870 IC & Coroutines: Do not box suspend operator fun invoke receiver
if it is called using parens and not by calling 'invoke' method.

Use underlying type when calling continuation constructor if suspend
function is method inside inline class.

 #KT-43505 Fixed
 #KT-39437 Fixed
2020-11-26 15:08:56 +01:00
Ilmir Usmanov 4e334217a8 IC & Coroutines: Unbox inline class parameter of suspend lambda
inside 'create' if 'create' overrides 'create' from
BaseContinuationImpl. In other words, unbox the parameter if 'create'
accepts only one parameter.

 #KT-43249 Fixed
 #KT-43533 Fixed
2020-11-26 15:08:54 +01:00
Ilmir Usmanov eba260f681 IC & Coroutines: Unbox inline classes of suspend lambdas
inside 'invoke' if 'create' does not override 'create' from
BaseContinuationImpl. In other words, when suspend lambda accepts more
than one parameter (including receiver).

Do that only if we do not generate bridge 'invoke' method, since
inline classes are unboxed in the bridge.

Use mangled name for 'create' function in this case inside 'invoke'.

 #KT-43249 In progress
 #KT-39847 Fixed
 #KT-38937 Fixed
2020-11-26 15:08:51 +01:00
Dmitry Petrov e5dce9f994 KT-42933 inline class backing field can't be static 2020-11-25 17:31:46 +03:00
Dmitry Petrov f6abc5c3cf KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only 2020-11-25 17:31:46 +03:00
Dmitry Petrov 498047e64e KT-43562 don't remap static inline class funs as special builtins 2020-11-25 17:31:46 +03:00
pyos 7327c20200 FIR: add a resolution mode for property delegates
Like function arguments, they are context-dependent, but unlike function
arguments, callable references should be resolved eagerly as if they are
explicit receivers.
2020-11-25 16:55:10 +03:00
Victor Petukhov 04846ca47a Rework checking constraints by presented OnlyInputTypes annotation in accordance with changed incorporation mechanism 2020-11-25 11:15:23 +03:00
Victor Petukhov 0857b9c9e7 Rethink constraints incorporation
Namely, remove incorporation “otherInsideMyConstraint” to eliminate
constraint system redundancy and produce a potentially very large number
 of constructs.
Instead, introduce not so “spreadable” incorporation during variable
fixation (equality constraint with result type into other constraints).
^KT-41644 Fixed
^KT-42195 Fixed
^KT-42920 Fixed
^KT-42791 Fixed
^KT-41741 Fixed
2020-11-25 11:15:20 +03:00
Dmitry Petrov 3a166f3592 KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors 2020-11-24 16:06:20 +03:00
Ilya Goncharov efee3ea648 [JS IR] - Remove file lowering declarations from lowering phases
- rename fileToPurenessInitializers onto fileToInitializerPureness
- remove redundant check on top-level property

[JS IR] Rename initialis* to initializ* for consistency

[JS IR] Move propertyLazyInitialization property to context from configuration

[JS IR] Add test on lazy initialization properties order

[JS IR] Add multi module for lazy initialization of properties

[JS IR] Move tests onto js.translator

[JS IR] Rename fileToInitializerPureness according to context name

^KT-43222 fixed
2020-11-24 12:33:44 +03:00
Ilya Goncharov 3da9761f37 [JS IR] Add test on lazy initialisation
^KT-43222 fixed
2020-11-24 12:29:28 +03:00
Dmitry Petrov 2662679579 KT-43399 properly erase extension receiver type in property$annotations 2020-11-23 13:58:52 +03:00
Dmitry Petrov 551d0c1b64 JVM_IR KT-43440 private-to-this default interface funs are private 2020-11-23 13:56:17 +03:00
Dmitry Petrov bf7fdcda6e KT-42909 fix missing loop variable in 'withIndex' ranges 2020-11-23 13:56:17 +03:00
Kristoffer Andersen 18612c1ef0 [JVM+IR] Rebase LVT test of destructuing in lambda params
The debug experiece of destructuring patterns in lambdas is different
across the two backends due to the IR backend moving local variables
to fields.

However, since the destructuring variable is never actually visible in
the debugger (no linenumbers in the live range of the variable), and
the variable is never used for anything other than hiding it from the
debugger, we propose that it is not actually necessary to include it
in the LVT (and in fact, could be left out of the LVT on the old
backend).
2020-11-23 10:54:04 +01:00
LepilkinaElena dd9c0c5c6e Use separate logic for filtering and skipping in collectAndFilterRealOverrides [KT-43487] (#3921) 2020-11-20 19:10:41 +03:00
Dmitry Petrov b495fd542f JVM, JVM_IR: KT-42281 proper array->primitive coercion 2020-11-20 14:33:20 +03:00
Dmitry Petrov e59c8e0a5c JVM_IR KT-42137 bridges are not generated for fake overrides 2020-11-20 14:33:20 +03:00
Steven Schäfer 7bfe2c0bbc JVM IR: Update test expectation for testSamAdapterAndInlineOnce
...and remove redundant bytecode text tests.
2020-11-19 19:46:49 +01:00
Steven Schäfer 8574cb4466 JVM IR: Don't generate line numbers and null checks in SAM wrapper constructors 2020-11-19 19:46:49 +01:00
Steven Schäfer 68e2d0d245 JVM IR: Generate synthetic final implementation methods in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer a475fa2a21 JVM IR: Use raw types in SAM wrappers 2020-11-19 19:46:49 +01:00
Steven Schäfer 999151abac JVM IR: Generate SAM wrapper fields as synthetic final 2020-11-19 19:46:49 +01:00
Steven Schäfer ec1d42e92b JVM IR: Generate SAM wrapper classes as non-synthetic 2020-11-19 19:46:49 +01:00
Steven Schäfer 36711a768b JVM IR: Use inline SAM wrappers inside of inline lambdas 2020-11-19 19:46:49 +01:00
Ilmir Usmanov 7761d30365 Minor. Add test to check fallback 2020-11-19 17:39:33 +01:00
Ilmir Usmanov 2829d37cf5 IC mangling: Use old mangling scheme for stdlib
This way, new stdlib can still be usable in 1.4.20
2020-11-19 17:39:27 +01:00
Ilmir Usmanov c62093f54c IC mangling: Change mangling rules
1. Use 'x' for each parameter, which is not an inline class, every
possible clash is handled by signature rather than name. This change
makes more API changes binary-compatible. So, the changes are in line
with the vision of inline classes are value classes, like primitives.

2. Take return type into account when mangling a function if the return
type is inline class. Otherwise, boxing bridge will not be generated,
which leads to CCE at runtime.
2020-11-19 17:39:24 +01:00
Dmitry Petrov e17158d961 JVM_IR KT-42758 don't use 'this' for object self-reference by name 2020-11-19 16:34:04 +03:00
Dmitry Petrov 118a7d4e34 JVM_IR KT-43242 generate switch subject as primitive 'int' 2020-11-19 16:34:04 +03:00
Mads Ager 7b4e0b2f5d [JVM_IR] Deal with lowering ordering issues for JvmStatic function references.
Do not destructively update the @JvmStatic function, instead
create a copy on first access, and replace the original with
the copy in the jvm static lowering. This ensures that the original
function is seen in other lowerings independently of file lowering
order.
2020-11-18 17:13:00 +01:00
Dmitry Petrov 3d2f5f4bc1 KT-42018 explicitly cast inline class values in safe-as 2020-11-18 18:51:15 +03:00
Kristoffer Andersen edd3b457d4 [JVM+IR] Migrate/improve receiver mangling test suite 2020-11-18 15:18:10 +01:00