Commit Graph

45796 Commits

Author SHA1 Message Date
Ilya Goncharov e9cc2931cc [JS] Use kotlin-stdlib-js.klib instead of *.jar 2023-10-16 13:34:37 +00:00
Ilya Goncharov a79324037d [JS] Fix JPS artifacts cordinates 2023-10-16 13:34:37 +00:00
Alexander Udalov 9fd1445631 JVM: use metadata version 1.9 for .kotlin_module if LV=2.0
See the comment in the code for more info.

No proper test added because the compiler test infrastructure lacks the
ability to run old compiler versions, however I've verified manually
that the change fixes the issue.

 #KT-62531 Fixed
2023-10-16 12:45:47 +00:00
Dmitriy Novozhilov d5540ff035 [IR Actualizer] Don't report errors about not implemented members from actualizer
Reporting of those errors was implemented as an ad-hock solution for part
 of the KT-58881, and it was implemented incorrectly. There won't be any
 need in this reporting in actualizer after KT-58881 will be fixed, so
 there is no actual sense to fix their implementation in actualizer itself
 (as it will be removed)
2023-10-16 12:26:31 +00:00
Alexander Udalov 2788dcb5ff K2: resolve remove(Int) clash in JavaOverrideChecker
In Kotlin subclasses of `MutableCollection<Int>`, the method
`remove(Int)` has its argument boxed, so that it wouldn't clash with the
method from `java.util.List`. So `JavaOverrideChecker` should understand
that a Java method `boolean remove(java.lang.Integer)` overrides it,
otherwise platform declaration clash was reported.

The code is adapted from `forceSingleValueParameterBoxing` in K1's
`methodSignatureMapping.kt`.

The test has been moved and adapted from diagnostic to codegen box
tests, to check correct backend execution + runtime.

 #KT-62316 Fixed
2023-10-16 11:26:58 +00:00
Roman Efremov 8e023edc4f [K2] Add TODO for KT-62559 (prevent reporting ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT
...twice in CLI mode in K2).

MR: KT-MR-12245

^KT-60671 Fixed
2023-10-16 10:48:08 +00:00
Roman Efremov 0fd700de21 [FIR] Fix case with lazy resolve in expect-actual annotation checker
Unresolved annotation arguments were treated as absent arguments,
which lead to false-positive reports.
Add assert and test for that and fix.

MR: KT-MR-12245

^KT-60671 Fixed
2023-10-16 10:48:08 +00:00
Roman Efremov 4c75fb108f [Test] Add test for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic
...when annotations arguments are lazily resolved.

MR: KT-MR-12245

^KT-60671
2023-10-16 10:48:08 +00:00
Roman Efremov 423f4ca5f0 [FE, IR] Check compatibility of annotations set on type usages in expect and actual declarations
This includes checking of annotatins set on:

- value parameter types
- type parameter bound types
- extension functions receiver types
- function return types
- class super types

Fix in `defaultParams_inheritanceByDelegation_positive.kt`
is needed because of problem in resolution of implicit return types
(KT-62064), which leads to crash in annotation checker, because it
expects resolved return type.

MR: KT-MR-12245

^KT-60671 Fixed
2023-10-16 10:48:08 +00:00
Roman Efremov cb8529d65b [Test] Add tests for annotations set on type usages in expect and
...actual declarations.

 MR: KT-MR-12245

^KT-60671
2023-10-16 10:48:08 +00:00
Roman Efremov fbdc64cdad [FIR] In tree generator make it possible to add custom super types
...to element.

MR: KT-MR-12245

^KT-60671
2023-10-16 10:48:08 +00:00
Roman Efremov ab2c129466 [FE, IR] Refactor: extract compatibility check of two annotation lists to separate method
This is needed for subsequent checks of annotations
set on types, while currently method accepts only
declarations.

MR: KT-MR-12245

^KT-60671
2023-10-16 10:48:08 +00:00
Vladimir Dolzhenko d092e99ae8 Drop KtStubElementTypes#FILE
It has been marked as deprecated for a while and targeted to be deleted in 1.9.0

#KT-53781
2023-10-16 10:44:08 +00:00
Vladimir Sukharev 16dfc6df71 [FIR] Missing NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE
^KT-59433 Fixed
2023-10-16 09:08:23 +00:00
Vladimir Sukharev da1fa8fce4 [FIR] Revert: Fix K2: Introduced AMBIGUOUS_ANONYMOUS_TYPE_INFERRED
This reverts commit d7adc0ce32.


Merge-request: KT-MR-12569
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-16 09:05:58 +00:00
Mikhail Glukhikh bf65297d48 FIR2IR: make both 'multiplexing' offset-conversion functions not inline
This commit prevents duplication of lambda source code while inlining
offset-conversion functions.
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh f501c3870d FIR2IR: make source range for implicit invoke call similar to PSI2IR 2023-10-13 15:42:58 +00:00
Mikhail Glukhikh fe979cc822 K2: add source range test with extension lambda call
This test is equivalent to IDE debugger test
testNoParameterExtensionLambdaArgumentCallInInline3,
which changes behavior due to previous commit
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh b7b7dd1000 FIR2IR: make sources of qualified accesses & calls closer to PSI2IR
#KT-60111 Fixed
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh 7c66a3dc65 Add source range test around multi-line calls 2023-10-13 15:42:58 +00:00
Mikhail Glukhikh 0fb4c9b4fe FIR2IR: generate specific sources for property accessors
Related to KT-60111
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh f38b8fd8cb K2: reproduce KT-60111 2023-10-13 15:42:58 +00:00
Mikhail Glukhikh c4ec576a99 FIR2IR: make *Assign call origins closer to PSI2IR
#KT-60261 In Progress
2023-10-13 15:42:58 +00:00
Mikhail Glukhikh 13ae4abe52 FIR2IR: use elvis temporary variable name closer to PSI2IR
Related to KT-61983
2023-10-13 15:42:57 +00:00
Roman Efremov d09c3783fd [K2] Fix mistake in language feature name for
...`DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE`
diagnostic.

^KT-62036
2023-10-13 12:30:41 +00:00
Dmitrii Gridin b2c8d7e777 [FIR] do not treat external ide annotations as real one
Such annotations are supposed to affect only diagnostic warnings

^KT-62310 Fixed
2023-10-13 12:16:12 +00:00
Dmitrii Gridin 2cac922cd0 [FIR] add tests on external annotations
Tests are excluded in COMPILED_JAVA mode because in this
mode external annotations are not present at all

^KT-62310
2023-10-13 12:16:12 +00:00
Nikolay Lunyak e452113a7a [FIR] Fix missing INVISIBLE_REFERENCE on imports
^KT-59927 Fixed
2023-10-13 11:56:54 +00:00
Nikolay Lunyak 21cb5cf83a [FIR] Store the first file in data.state.classifierContainerFileMap
Note that this doesn't affect
multi-module configurations

^KT-59927
2023-10-13 11:56:54 +00:00
Nikolay Lunyak 41c3f98419 [FIR] Make resolution of classes in FirProvider more reasonable.
See the `privateInFile.fir.kt` test.
Type mismatches are simply confusing.

`inheritorOfExpectSealedClass.out`
reports unresolved reference probably
because now it resolves into the expect
declaration, rather than the actual one.
K1 doesn't report UNRESOLVED_REFERENCE
in this case. But this is red code
anyway. And this behavior still
depends on the order in which the compiler
receives both the declarations.

^KT-59927
^KT-62567
2023-10-13 11:56:54 +00:00
Nikolay Lunyak a9ceae9667 [FIR] Add the privateInFileInDifferentModule test
We only see the redeclaration
diagnostics on the declarations inside
the second file, because of
`FirRecorder::visitRegularClass`.
`data.state.classifierContainerFileMap`
references the last file, so
when checking the visibility of
the first `private class C { ... }`
(when collecting declarations that
conflict with the second `private class C`)
the provider returns the second file
instead of the first one, so the class
behaves as it is visible, and
`collectTopLevelConflict` returns in
this case.

As for why `INVISIBLE_*`s are reported
inside the first file: this is because
`data.state.classifierMap` stores the
last classifier it sees instead of
the first one.

^KT-62537
2023-10-13 11:56:54 +00:00
Sergej Jaskiewicz df0f86bf8d [FIR generator] Use a single list of parent TypeRefs for elements
(Instead of storing the list of parent elements + the map of parent
arguments)
2023-10-13 10:11:38 +00:00
Ivan Kylchik 350ee4be1d [Native] Replace consequence line and column calls with a single one 2023-10-13 08:50:47 +00:00
Ivan Kylchik 1be98b8f08 [IR] Extract some common code into AbstractIrFileEntry 2023-10-13 08:50:47 +00:00
Ivan Kylchik 6039d39546 [IR] Add new method IrFileEntry.getLineAndColumnNumbers
Calling this method instead of sequence of `getLineNumber` and
`getLineNumber` is faster because we eliminate one exess
`getLineNumber` call.
2023-10-13 08:50:47 +00:00
Ivan Kylchik a30d0aeeb0 [JVM] Replace AbstractInsnNode.getType with new util function
This change speeds up backend by approximately 0.96%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik 67460962c3 [JVM] Use HashSet instead of SmartSet in MaxStackFrameSizeAndLocalsCalculator
This change speeds up backend by approximately 0.25%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik 05b364a5f1 [JVM] Simplify equals method in StrictBasicValue 2023-10-13 08:50:47 +00:00
Ivan Kylchik 84a47a2298 [IR] Drop SLRUCache usages from NaiveSourceBasedFileEntryImpl
Access to `SLRUCache` is a bottleneck when we call `getLineNumber`.
We are very rarely going to access the same offset. This change
speeds up backend by approximately 0.43%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik 4a07454d8d [IR] Drop excess resolveFakeOverride from EVALUATION_MODE
This change doesn't affect semantic and speeds up
backend by approximately 0.06%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik 3335db0aa8 [IR] Simplify unsigned check in EVALUATION_MODE
This way we are not creating useless intermediate lists. This change
speeds up backend by approximately 0.38%.
2023-10-13 08:50:47 +00:00
Ivan Kylchik f36f37bf47 [IR] Drop isNan fun from IrInterpreterCommonChecker
It is not used anymore after 858f432807
2023-10-13 08:50:47 +00:00
Ivan Kylchik 9135e9d13d [JVM_IR] Drop reversed call from writeLocalVariablesInTable
It is better to use simple for loop. This change speeds up
backend by approximately 0.07%.
2023-10-13 08:50:47 +00:00
Pavel Kunyavskiy 156c341eeb [K/N] Implement objc overridablity condition for IR
^KT-61511
2023-10-13 08:15:01 +00:00
Pavel Kunyavskiy 202f30f910 [K/N] Extract ObjcOverridabilityCondition to separate file
^Kt-61511
2023-10-13 08:15:00 +00:00
Ilya Goncharov 1fd9706f47 [K2] KT-60080 Fix packageFqn for property accessor symbol
^KT-60080 fixed
2023-10-12 17:44:47 +00:00
Ilya Kirillov 4d38cc4548 [Analysis API Standalone] fix exception on invalid KLib from symbol provider
^KT-62244 fixed
2023-10-12 15:15:05 +00:00
Mikhail Glukhikh d005d1cd68 Add accidentally forgotten IrSourceRangesDumpHandler to IR text tests 2023-10-12 15:06:47 +00:00
Igor Chevdar a8c6074c45 [IR] Use InlineFunctionResolver for inlinable function references
#KT-62313 Fixed
2023-10-12 13:34:13 +00:00
Igor Chevdar c6470a684d [box-tests] Added a reproducer for #KT-62313 2023-10-12 13:34:13 +00:00