Commit Graph

48171 Commits

Author SHA1 Message Date
Kirill Rakhman 85a1d67d19 [FIR] Fix giant type produced by CST
#KT-65704 Fixed
2024-03-18 08:41:26 +00:00
Kirill Rakhman 81c0ee471f [Tests] Reproduce #KT-65704 2024-03-18 08:41:26 +00:00
Vladimir Sukharev e03af07a1c [Tests] Revive KlibEvolutionTests
Allows CI testing for KT-44602, KT-44604, KT-44598, KT-44599, KT-66342

^KT-44602
2024-03-16 07:50:33 +00:00
Dmitriy Dolovov 722acc028a Revert "[K/N] add testing setup for header klibs and caches"
This reverts commit a89893a2c5.
2024-03-15 22:32:50 +01:00
Dmitriy Dolovov a78d498e36 Revert "[K/N] add flag to klib manifest for header klibs"
This reverts commit 59f0c0464b.
2024-03-15 22:32:50 +01:00
Stanislav Ruban a781a08386 [tests] Fix KMP test data affected by 9d566465
Affected test data was in a correct state in the corresponding MR branch, but that state was invalidated by the appearance of 9d566465 in the master branch. Because the MR branch in question was created and checked via CI runs before 9d566465 was committed to master, the discrepancy couldn't be caught by MR quality gates.
2024-03-15 17:00:03 +00:00
Sergej Jaskiewicz 1476b89ea3 [build] Forward the JDK_21_0 environment variable to tests 2024-03-15 15:07:13 +00:00
Alexander Udalov 5cbaf077f3 JVM: remove FilteredJvmDiagnostics
The purpose of this class was to avoid reporting conflicting JVM
signatures / accidental override errors when there's a similar (e.g.
conflicting overloads) diagnostic already reported.

It was not used meaningfully because it only affected diagnostics
reported by the old JVM backend. Also, in real life, backend diagnostics
would not be reported anyway in most cases because backend is not even
run if there's an error after frontend.
2024-03-15 14:39:56 +00:00
Alexander Udalov b4d65fe5cd JVM: remove obsolete code for reporting JVM backend diagnostics
The last remaining usages from diagnostic tests were removed in previous
commits.
2024-03-15 14:39:56 +00:00
Alexander Udalov 32c8664f71 Tests: remove JVM diagnostics from AbstractDiagnosticsTest
There's no behavior specific for JVM backend diagnostics in any of the
affected tests, and this code is using an incorrect way to obtain those
diagnostics, so it should be removed anyway.
2024-03-15 14:39:56 +00:00
Alexander Udalov 88d159ec65 IR: minor, update the comment about K2 kapt in IrGenerationExtension
K2 kapt does use stub generation in the end after all, but using the
analysis API instead of the IR backend.
2024-03-15 14:32:39 +00:00
Alejandro Serrano Mena a18dca5728 Add missing cases for PROPERTY_AS_OPERATOR 2024-03-15 12:52:10 +00:00
Kirill Rakhman 2095f90e69 [FIR] Fix exception in Java scope caused by inherited member with implicit return type
It's caused by checking the return type of an inherited property.
toConeKotlinTypeProbablyFlexible() returns an error type when the
type ref is unresolved instead of throwing.
This "breaks" some override checks and in the added test, it leads
to an additional candidate being created for a synthetic property.
However, the candidate has applicability K2_SYNTHETIC_RESOLVED
and gets filtered out because the real property has a higher
applicability.

#KT-66392 Fixed
2024-03-15 12:01:55 +00:00
Stanislav Ruban 8f420eb3e1 [FIR][checkers][Wasm] Turn FirWasmJsInteropTypesChecker into a platform checker
#KT-66475 Fixed
2024-03-15 11:40:55 +00:00
Stanislav Ruban 478c1a6d50 [FIR][checkers][JS] Move reporting of FirJsErrors.EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE to FirJsInheritanceClassChecker
#KT-66474 Fixed
2024-03-15 11:40:55 +00:00
Stanislav Ruban 0549c6c75b [FIR][checkers][Wasm] Expand type aliases in FirWasmExternalInheritanceChecker
#KT-66473 Fixed
2024-03-15 11:40:55 +00:00
Stanislav Ruban 4d17a908e2 [tests][FIR][checkers][Wasm] Add test data for KT-66475 2024-03-15 11:40:55 +00:00
Stanislav Ruban bf77cc3d0c [tests][FIR][checkers][JS] Add test data for KT-66474 2024-03-15 11:40:55 +00:00
Stanislav Ruban 41e8b45def [tests][FIR][checkers][Wasm] Add test data for KT-66473 2024-03-15 11:40:55 +00:00
Stanislav Ruban 24d7d8088c [tests][FIR][checkers][Wasm] Prepare for addition of KMP Wasm test data 2024-03-15 11:40:55 +00:00
Stanislav Ruban a7332a4cad [minor][FIR][checkers][Wasm] Refactor FirWasmJsInteropTypesChecker for readability 2024-03-15 11:40:55 +00:00
Stanislav Ruban 4dd0a25eca [FIR][checkers][Wasm] Refine WRONG_JS_INTEROP_TYPE reporting
This commit improves four aspects of WRONG_JS_INTEROP_TYPE error reporting:
1) more precise source code ranges are preferred when possible (e.g. value parameter type instead of the entire value parameter, explicit return type instead of the entire declaration, etc.)
2) only relevant parameter and return types of function types are reported as wrong (to prevent confusion with the "function types are supported" part of the error message)
3) WRONG_JS_INTEROP_TYPE errors are now deduplicated in cases where more than one such error was previously reported because of compiler-generated declarations
4) error messages were slightly proofread and contain slightly more information now
2024-03-15 11:40:55 +00:00
Stanislav Ruban a65ea2ce02 [FIR][checkers][Wasm] Reorder information in messages for WRONG_JS_INTEROP_TYPE 2024-03-15 11:40:55 +00:00
Stanislav Ruban b165ff675b [tests][FIR][checkers][Wasm] Improve test coverage for WRONG_JS_INTEROP_TYPE 2024-03-15 11:40:55 +00:00
Mikhail Glukhikh c6e0268893 Revert "Temporary: make PRE_RELEASE_CLASS a warning in both K1/K2 (KT-66551)"
This reverts commit a0cb713d19.
#KT-66551 Fixed
2024-03-15 11:33:10 +00:00
Mikhail Glukhikh 8ac576614f Revert "Temporary: mute PRE_RELEASE_CLASS in some tests (KT-66551)"
This reverts commit 893e5cac
2024-03-15 11:33:10 +00:00
Mikhail Glukhikh e22a2016b1 Revert "Temporary: make "Pre-release classes were found in dependencies" warning"
This reverts commit 92cf3e3343.
2024-03-15 11:33:10 +00:00
Johan Bay 59f0c0464b [K/N] add flag to klib manifest for header klibs
^KT-65443
2024-03-15 10:24:26 +00:00
Johan Bay a89893a2c5 [K/N] add testing setup for header klibs and caches
^KT-65443
2024-03-15 10:24:26 +00:00
Roman Golyshev d8ae22e824 KTIJ-29015 [Plugin API] Add documentation to the ExtensionStorage.registerDisposable 2024-03-15 09:56:13 +00:00
Mikhail Glukhikh 40c4e865c7 K2/Java/enhancement: implement wildcards replacement with flexible bounds
This commit in fact changes two very related places:
- first, it implements forgotten 'enhancedForWarnings' in K2 enhancement
- second, it repeats KT-48515 fix for K2 while enhancing wildcards

#KT-65594 Fixed
Related to KT-48515, KT-63746
2024-03-15 09:40:54 +00:00
Mikhail Glukhikh 5b0cb5c9db K2/jspecify: reproduce KT-65594 2024-03-15 09:40:53 +00:00
Dmitriy Novozhilov 30e2af7b66 [FIR] Threat some error candidate applicabilities with same priority
There is a thing that `CandidateCollector` adds error candidate to the
  list of resulting candidates only if its applicability at least the
  same as current applicability of the collector

Also there is a problem, that deserialized symbol provider in CLI compiler
  and stub-based symbol provider in AA may return the same declarations
  in different order. This provokes the difference in the resulting set
  of candidates between the two modes:

```
val x by unresolved
```

During the resolution of this code compiler tries to find function `getValue`,
  and there are 6 of them in the stdlib. From them we are interseted in
  specific three:

1. `fun <K, V> Map<K, V>.getValue(key: R|K|): R|V|`
2. `inline operator fun <V, V1 : V> Map<in String, @Exact V>.getValue(thisRef: Any?, property: KProperty<*>): V1`
3. `inline operator fun <V, V1 : V> MutableMap<in String, out @Exact V>.getValue(thisRef: Any?, property: KProperty<*>): V1`

- (1) is inapplicable with `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
- (2) and (3) are inapplicable with `INAPPLICABLE_WRONG_RECEIVER`
- `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR` is more specific applicability than `INAPPLICABLE_WRONG_RECEIVER`
- CLI compiler always sees those functions in order 1 -> 2 -> 3
- AA providers sometimes returns them in order 2 -> 3 -> 1

So in CLI compilation candidates (2) and (3) are not added to the resulting
  set, as they are "less applicable" than (1), but in AA compilation they
  can be added to the set before (1), which causes sporadic change in
  FIR dump of `unsafeAssignmentExtra.kt`

To workaround this problem it was decided to treat `INAPPLICABLE_ARGUMENTS_MAPPING_ERROR`
  and `INAPPLICABLE_WRONG_RECEIVER` applicabilities as "equally specific"

^KT-65218 Fixed
2024-03-15 08:21:42 +00:00
Sergej Jaskiewicz 7ad4e58a7a [FIR tree generator] Add a kDoc for FirUnitExpression 2024-03-14 23:19:40 +00:00
Mikhail Glukhikh cd20f31810 K2: introduce JavaTypeParameterDefaultRepresentationWithDNN exp. feature
#KT-66447 Fixed
2024-03-14 22:39:03 +00:00
Alevtina.Gamzikova 7d06b34bfa [Test] KT-64350 Add testcases 2024-03-14 20:41:53 +00:00
Dmitriy Novozhilov cc6e0eb218 [Test] Unmute passing test about binary poisoning (KT-66551) 2024-03-14 19:53:25 +00:00
Sergej Jaskiewicz 9851ff1905 [FIR] Reproduce KT-66277, KT-66279, KT-66512 and KT-66534 2024-03-14 18:34:30 +00:00
Dmitrii Gridin 675bf36049 [FIR] JavaTypeParameterStack: allow nullable return from get
It is not always possible to have the correct mapping,
at least on the Analysis API side

^KT-66530 Fixed
2024-03-14 18:05:15 +00:00
Artem Kobzar eb8054ac1e [K/Wasm] Fix object optimization false trigger on non-pure objects ^KT-66471 Fixed 2024-03-14 17:12:45 +00:00
Wojciech Litewka fae50f1258 [tree generator] Drop deprecated IrPackageFragment.fqName 2024-03-14 17:07:02 +00:00
Wojciech Litewka c1266daf73 [tree generator] Remove AbstractField.defaultValueInBase
It is now unneeded, and future needs should be possible to
be resolved otherwise.
Removing it will simplify further changes to tree generator,
especially for IR.
2024-03-14 17:07:02 +00:00
Wojciech Litewka 6b9a671476 [IR] Minor: Specify IrPackageFragment.fqName literally in IrTree
It is not a real field, only a compatibility facade for another one.
Needed for the next commit.
2024-03-14 17:07:02 +00:00
Wojciech Litewka 5e9c3025bb [IR] Move IrValueDeclaration.isAssignable to extension property
to remove custom logic from generated classes, in particular
to simplify source generator itself.
2024-03-14 17:07:02 +00:00
Ivan Kylchik ddcef6396e [IR] Drop inlineArgumentsWithOriginalOffset from inliner
#KT-66509
2024-03-14 16:00:53 +00:00
Ivan Kylchik 3ee126de74 [IR] Drop alwaysCreateTemporaryVariablesForArguments from inliner
This parameter was always set to be true.

#KT-66509
2024-03-14 16:00:53 +00:00
Alexander Udalov 324d2e042a Tests: do not report backend diagnostics in diagnostic tests
There's a separate test data directory `testsWithJvmBackend` with a
runner that properly invokes the JVM backend and reports diagnostics
from it. All tests where JVM diagnostic presence/absence is important
were copied/moved there in this and previous commits.

The problem with the code removed in this commit is that it invoked some
parts of the _old JVM backend_ and old light classes, which is very far
from what users see in the production compiler at this point. This led
to real issues where we implemented incorrect behavior in K2 based on
the misleading diagnostic report from the K1 test.

The diagnostic in `triangleWithFlexibleTypeAndSubstitution4.kt` was
removed, but there's a copy of this test in `codegen/box/javaInterop`
which fails for K2 (KT-66529).

The diagnostic in `intersectionWithMappedSignature.kt` was removed and
that is OK because at this point CONFLICTING_JVM_DECLARATIONS there
seems like a bug in the old JVM backend.
2024-03-14 12:38:48 +00:00
Alexander Udalov 7d6cd8d126 Tests: remove diagnostic test with incorrect compiler behavior
In fact the latest compiler (neither K1 nor K2) does NOT report an error
here, see KT-66522. The error was there in the diagnostic test because
the test used custom code which invoked parts of the old JVM backend to
report signature clash errors.

The issue is rather minor and is present since 1.5, so to reduce
confusion, the test is deleted.

 #KT-66522
2024-03-14 12:38:48 +00:00
Alexander Udalov d986e0ee9c Tests: move more diagnostic tests to testsWithJvmBackend
In this commit, tests where backend diagnostics were reported correctly
are being moved.

FirScopeDumpHandler was added to FIR diagnostic tests with JVM backend
to support `SCOPE_DUMP` in `overridesBuiltinNoMagic.kt` and
`charAtAndOverload.kt`.
2024-03-14 12:38:48 +00:00
Alexander Udalov 56a1a3153b Tests: move inline class-related diagnostic tests
... with backend-reported diagnostics to testsWithJvmBackend.
2024-03-14 12:38:47 +00:00