Commit Graph

19217 Commits

Author SHA1 Message Date
Dmitrii Gridin d64fc9b777 [SLC] map kotlin.Unit type typealias into void return type
^KT-65843 Fixed
2024-02-19 21:24:42 +00:00
Dmitrii Gridin 8dd66c0810 [LC] add test on unit type actualization
^KT-65843
2024-02-19 21:24:42 +00:00
Ivan Kochurkin 04ead1716a [FIR] Prohibit constructor and supertype on typealias with type projection
Introduce `CONSTRUCTOR_OR_SUPERTYPE_ON_TYPEALIAS_WITH_TYPE_PROJECTION`

^KT-60305 Fixed
2024-02-19 19:27:28 +00:00
vladislav.grechko d753a22fc6 [FIR] Handle expect declarations in JVM backend
1. Do not generate bytecode for expect declarations

2. Serialize @OptionalExpectation annotations into .kotlin_module file

^KT-62931: Fixed
2024-02-19 18:17:37 +00:00
vladislav.grechko b74501ee93 Compare module metadata in JVM ABI consistency tests 2024-02-19 18:17:37 +00:00
Evgeniy.Zhelenskiy 782e35dc8d [K2, JVM, IR] Add tests for clashing inner classes names
#KT-65586 #KT-65439
2024-02-19 15:20:57 +00:00
Dmitriy Novozhilov d1e7b9b4cf [Test] Add Fir Identical checkers for signature dump handler 2024-02-19 13:59:48 +00:00
Alexander Udalov 90ff8f0e64 JVM: support -Xjdk-release=7/1.7
#KT-59098 Fixed
2024-02-19 11:44:58 +00:00
Alexander Udalov 12f393791b JVM: allow -jvm-target 1.8 with -Xjdk-release=1.6
#KT-59098
2024-02-19 11:44:58 +00:00
Alexander Udalov 1bc08fc5b8 JVM: report error on -Xjdk-release=6 without -jvm-target
#KT-59098
2024-02-19 11:44:58 +00:00
Alexander Udalov cdcb65c749 Tests: minor, slightly move JDK path substitution logic
It will be used in other CLI tests in subsequent commits.
2024-02-19 11:44:58 +00:00
Ilya Goncharov abb5f55087 [Wasm] Use static import for wasm imports
^KT-65777 fixed
2024-02-19 10:01:10 +00:00
Anastasia.Nekrasova fd4f6c90c7 [K/N][K2] K2 behavioral difference with inconsistent inheritance of ObjCName
Support for complex cases with multiple substitution overrides.

#KT-64276 Fixed
2024-02-19 09:29:43 +00:00
Anastasia.Nekrasova d69240a2d5 [FIR] Fixed behavior of FirAnnotation.findArgumentByName for resolved annotations
The 'findArgumentByName' function was returning an invalid result for
annotation arguments with omitted argument name.

#KT-64276
2024-02-19 09:29:43 +00:00
Anastasia.Nekrasova bb8c7dd04c [K/N][K2] K2 behavioral difference with inconsistent inheritance of ObjCName
When a declaration with an ObjC annotation is stored in a different
module, the annotation arguments are not resolved by default. This leads
to a bug in the checker. Before attempting to find the objCName, it is
necessary to resolve the annotation first.

#KT-64276
2024-02-19 09:29:43 +00:00
vladislav.grechko 3dda88ddc2 [FIR] Handle FirErrorExpression when resolving arguments
^KT-65787: Fixed
2024-02-19 08:50:59 +00:00
Pavel Kunyavskiy 576851e514 [Tests] Update testdata after bad rebase 2024-02-16 15:37:28 +00:00
Pavel Kunyavskiy e6f4d6e6fa [Tests] Use stable order for ir/kotlinLike dumps
^KT-65406
2024-02-16 10:19:38 +00:00
Pavel Kunyavskiy 0fa42a9c11 [Tests] More conservative stableOrdered dump
Order of enum entries and fields matters, we can't sort them too.

^KT-65460
2024-02-16 10:19:38 +00:00
Pavel Punegov 8dcb763eca [K/N][test] Reset state in StateMachineChecker before the test
boxInline tests for suspend use StateMachineChecker and share the state
if compiled and run together. The single value accessed from all tests.
It is enough to reset state before the test is run.
2024-02-15 18:07:25 +00:00
Nikolay Lunyak 8f8c7fe7cf [FIR] Properly calculate visibilities
`testIntersectionOfPrimitiveBasedFunctions`
is fine, because we deprecate this
already in ^KT-63243.

`CANNOT_INFER_VISIBILITY` is
positioned as `DECLARATION_NAME`,
just in case we decide for
some reason that we do want to
report it along with
`MANY_*_NOT_IMPLEMENTED`. In that
case, we'd get a problem that
their bounds overlap, but not
completely contain one another.

^KT-63741 Fixed
^KT-59400 Fixed
2024-02-15 16:10:14 +00:00
Nikolay Lunyak 7056ad5325 [FIR] Set status.isOverride for fake overrides
Even though SO may not be correct
overrides sometimes, it feels more
natural to treat fake overrides as...
well, "overrides". And without it
we'd need to make the code in
`FirOverrideChecker` less intuitive.
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 694029d67f [FIR] Run FirOverrideChecker for fake overrides
The change in
`FirOptInUsageBaseChecker` is needed
to prevent `OPT_IN_OVERRIDE` on
intersection overrides where one
of the base functions requires opt-in.
We never designed this in such
a way that it's an error.
See:
`FirPsiOldFrontendDiagnosticsTestGenerated.testIncorrectTargetsForExperimentalAnnotation`.

According to KT-63741, the case like
`kt40510.fir.kt` should, in fact,
be an error. It will be addressed
separately.
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 3b5fff5473 [FIR] Don't copy VP default values for fake overrides
In general, overrides should not
contain default values, and it's
better to make fake overrides be close
to proper overrides as much as
possible. It will be important when
we begin running `FirOverrideChecker`
for fake overrides.

^KT-63879 Fixed
^KT-65534
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 249886fb13 [FIR] Ensure the case from KT-63741 works
^KT-63741
2024-02-15 16:10:13 +00:00
Nikolay Lunyak 2ad0be7bdc [FIR] Ensure the case from KT-63578 works
^KT-63578
2024-02-15 16:10:12 +00:00
Dmitrii Gridin c78d3edd24 [SLC] support type parameter annotations
^KT-65112 Fixed
2024-02-15 15:18:02 +00:00
Dmitrii Gridin 717dd08fd4 [LC] PsiClassRenderer: render type parameter annotations
^KT-65112
2024-02-15 15:18:02 +00:00
Dmitrii Gridin 3e3c932bf6 [LC] add tests on type parameter annotations
^KT-65112
2024-02-15 15:18:02 +00:00
Stanislav Ruban 9fb920874c [tests] Add additional test data for KT-64222 2024-02-15 13:22:23 +00:00
Dmitriy Novozhilov b87aa470dd [Test] Ensure FIR doesn't fail on recursive private-to-this case
^KT-55446
2024-02-15 13:08:36 +00:00
Dmitriy Novozhilov c64575f4a2 [FIR] Move check for _private-to-this_ visibility into checker
^KT-55446
^KT-65790 Fixed
2024-02-15 13:08:35 +00:00
Kirill Rakhman 81e0abeb8f [FIR] Fix mapped constructor hiding logic
Partially reverts 24367e0ad8

Constructors have their own list of hidden/visible.
We now require the constructor to be in VISIBLE_CONSTRUCTOR_SIGNATURES,
everything else is hidden.
This makes it unnecessary to check HIDDEN_CONSTRUCTOR_SIGNATURES

#KT-65821 Fixed
2024-02-15 13:08:15 +00:00
Dmitriy Novozhilov 84f0f6e099 [FIR] Resolve statuses of supertypes for all non-source classes
Previously we forced computation only for java and precompiled classes,
  assuming, that binary class can not extend source class, but it's not
  true in two cases:
1. Classpath substitution: class with same name declared in library and
   the source (more rare case)
2. Metadata compilation: depends-on dependcies are passed in binary
   format, so `expect class` may be a binary one and corresponding
   `actual class` may be a source. So if some class in `common` module
   extend this expect class, actual class will be substituted instead of it

^KT-65669 Fixed
2024-02-15 12:18:48 +00:00
Dmitriy Dolovov 9219a8f485 [FIR] Expand type of vararg parameter before constructing array type
This helps to have a primitive array instead of an array of primitives
as the type of vararg value parameter. Also, this prevents
ABI-incompatibility with the libraries (KLIBs) compiled with K1.

^KT-65588
2024-02-15 11:55:32 +00:00
Kirill Rakhman 33648e1f44 [FIR] Unwrap vararg array types for diagnostic rendering
#KT-65770 Fixed
2024-02-15 10:48:56 +00:00
Kirill Rakhman eae72eac54 [FIR] Fix substitution of Java arrays enhanced for warning
... w.r.t the variance of their type arguments.
Because `Object[]` is represented as `Array<Any>..Array<out Any>?`,
when we substitute, we can't just take the upper bound because it
changes the variance of the type agument.
Instead, we construct a flexible type and use both bounds, like with
collections with flexible mutability.

#KT-65246 Fixed
2024-02-15 10:48:56 +00:00
Kirill Rakhman 879cdd5952 [FIR] Fix flattening of substitution overrides of intersection overrides for subsumed check
#KT-65555 Fixed
2024-02-15 08:43:06 +00:00
Roman Efremov 3994e3f63a [FIR] Deprecate using typealias as callable qualifier in import
^KT-64350 Fixed
2024-02-15 08:37:02 +00:00
Vladimir Sukharev bf0150108d [K/N][Tests] Move filecheck and cinterop tests to /native/
^KT-61259
2024-02-14 23:36:34 +00:00
Dmitriy Dolovov 05cbe66ee0 [FIR][tests] Unify IntArrayAsVararg.kt test between K1 and K2
Rename `main` function to `test` to avoid running JVM-specific mangling
and having different IR signature dumps for K1 and K2.

^KT-65588
2024-02-14 23:00:04 +00:00
Alexander Udalov 41ef3da5ff Tests: add regression test for KT-63448 2024-02-14 21:44:42 +00:00
Brian Norman e3ddeff230 [FIR] Track local variable assigned types for smartcast stability
When a lambda captures a local variable without a contract, future
assignments can impact the smartcast stability for that variable within
the lambda. Because future assignments can appear in both resolved and
unresolved code, track each assignment as encountered. To determine if
a smartcast can be considered stable, check that all future assignments
are resolved and do not revert variable to a super type.

^KT-58191 Fixed
2024-02-14 17:44:53 +00:00
Dmitrii Gridin e02c28c88a [LL FIR] support lazy resolve of destructuring declaration entries
^KT-62840 Fixed
^KT-65727
2024-02-14 16:16:01 +00:00
Kirill Rakhman e39af4583e [FIR] Report deprecation on synthetic property calls on super receivers
#KT-65438 Fixed
2024-02-14 13:13:01 +00:00
Kirill Rakhman e8cbd8a1cd [FIR] Report OVERRIDE_DEPRECATION for overrides of HIDDEN_IN_DECLARING_CLASS_ONLY
#KT-65438 Fixed
2024-02-14 13:13:01 +00:00
Kirill Rakhman 24367e0ad8 [FIR] Implement isHiddenEverywhereBesideSuperCalls logic for constructors
#KT-61448 Fixed
2024-02-14 13:13:01 +00:00
Kirill Rakhman 2f49272c42 [FIR] Create fake hidden versions of List.getFirst/getLast in JDK < 21
... so that overrides are marked as deprecated regardless of the JDK.

#KT-65440 Fixed
2024-02-14 13:13:01 +00:00
Kirill Rakhman c6b2675089 [FIR] Implement deprecation for calls to overrides of hidden
#KT-65438
2024-02-14 13:13:00 +00:00
Kirill Rakhman fc6d25e50f [FIR] By default, only hide members from mapped scope but not overrides
This affects methods like List.getFirst/getLast where it was decided
to keep them hidden but to make them visible on overrides like
ArrayList or LinkedList.
The goal is to prevent a breaking change since some implementations
like LinkedList had this method before JDK 21.

#KT-65438
2024-02-14 13:13:00 +00:00