Commit Graph

48095 Commits

Author SHA1 Message Date
Mikhail Glukhikh f37347ddb7 Temporarily mute failing test around IS_PRE_RELEASE (related to KT-62063)
This test should be fixed by bootstrapping or in KT-66551
2024-03-13 20:38:44 +00:00
Mikhail Glukhikh dc879a3875 K2: drop poisoning flag due to upcoming 2.0.0-RC
#KT-62063 Fixed
2024-03-13 20:38:44 +00:00
Kirill Rakhman b74dcb77e3 [FIR] Add opt-in to replaceIsTrailingLambda
#KT-66553
2024-03-13 17:05:48 +00:00
Kirill Rakhman 0cac6b66d5 [FIR] Remove vararg workaround in FirArgumentsToParametersMapper
Since we save the unresolved argument list, we don't need the workaround
anymore.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman fbb21f2406 [FIR2IR] Remove argument unwrapping for SAM conversion
FirNamedArgumentExpressions don't exist anymore during FIR2IR phase
and so we don't need to unwrap arguments here anymore.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 015f257031 [FIR2IR] Remove special handling of named arguments for vararg
FirNamedArgumentExpressions don't exist anymore during FIR2IR phase
and so handling FirSpreadArgumentExpression in Fir2IrVisitor is
sufficient.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman d16cc668cd [FIR] Add KDocs for wrapped argument expressions
#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 454ef4ae46 [FIR] Build resolved argument list for augmented array assignment get call
This lets us get rid of some fallback code in FIR2IR that handles
unresolved argument lists.
After this, we should have an invariant that all non-empty argument
lists are resolved when FIR2IR runs.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 8443daf78d [FIR] Remove FirNamedArgumentExpressions during completion
They are mostly necessary for argument mapping during resolution.
To support a couple checkers, we transform named args for varargs
into "fake" spread expressions.

Other than that, named arguments aren't needed for anything and often
lead to bugs where we forget to unwrap them for something, so it's
better to get rid of them.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 03fc0fd381 [FIR] Remove FirLambdaArgumentExpression
It's not really necessary if the information about if the lambda was a
trailing lambda can be directly saved in FirAnonymousFunctionExpression.

Removing the FIR node uncovered a couple of bugs
(UNINITIALIZED_ENUM_ENTRY, ERROR_IN_CONTRACT_DESCRIPTION) that were
caused by assuming that a lambda is always a trailing lambda.

#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 1a5fa8d3f6 [Tests] Add test for suspend SAM conversion with trailing lambda
#KT-65878
#KT-66124
2024-03-13 17:05:48 +00:00
Kirill Rakhman 5a00984607 [FIR] Fix misleading return type 2024-03-13 17:05:48 +00:00
Kirill Rakhman b4d036ce58 [FIR] Remove unused code 2024-03-13 17:05:48 +00:00
Ivan Kylchik 61fabc02ba [K2] Resolve bodies of const properties during IMPLICIT_TYPES_BODY_RESOLVE
This is required to implement constant evaluator on the FIR level.

#KT-64151
2024-03-13 16:53:59 +00:00
Mikhail Glukhikh f656a9fdc6 Migrate some KT-65789 & KT-58920 tests on using take<ExpectedType>(arg) 2024-03-13 14:57:34 +00:00
Mikhail Glukhikh 0f53ee64d6 K2: make qualifier & classifier the same tower level
#KT-65789 Fixed
#KT-38031 Fixed
2024-03-13 14:57:34 +00:00
Mikhail Glukhikh d6e67e43f9 K1/K2: add a test for KT-62866 2024-03-13 14:57:34 +00:00
Mikhail Glukhikh 3b9e08d6b8 K1/K2: reproduce KT-65789 2024-03-13 14:57:33 +00:00
Roman Efremov 284d5437e5 [FIR] Don't transform call arguments during TYPES phase
Instead, it should happen during BODY_RESOLVE phase.

This fixes KT-66150. The problem was, that `super<B>.f()` expression
in delegated constructor call was transformed during TYPES phase,
and type transformer has no special logic for allowing bare types in
super qualifiers, like the one in expressions transformer (see
`org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer.transformSuperReceiver`).
As a result, `B` without type argument leads to
WrongNumberOfTypeArgumentsError.
It looks incorrect that expressions in constructor call resolved
during TYPES phase, so skipping transformation of
argument list seems like the best solution here.

^KT-66150 Fixed
2024-03-13 14:31:14 +00:00
Roman Efremov c4f89ab32e [Test] Add test reproducing incorrect error in K2 about super qualifier
...with type arguments.
Also, add lazy resolve test to check the subsequent changes are correct.

^KT-66150
2024-03-13 14:31:14 +00:00
Artem Kobzar a38d317824 [K/JS] Use globalThis isntead of this for UMD modules ^KT-45604 Fixed 2024-03-13 13:36:55 +00:00
Kirill Rakhman 43a08068fc [Tests] Add regression tests for KT-32754
#KT-32754 Fixed
2024-03-13 12:39:54 +00:00
Dmitriy Novozhilov c818ce9220 [Test] Add test for KT-66338 2024-03-13 09:17:17 +00:00
Alexander Udalov 55f9f74d5c Tests: do not report backend diagnostics if there's frontend error
In most affected tests, the backend diagnostic such as "conflicting JVM
signature" or "accidental override" is directly caused by some already
existing error reported by frontend, so it doesn't make sense to check
backend diagnostics there.

Tests where that was not the case were moved/copied to
`testsWithJvmBackend`.
2024-03-13 08:38:15 +00:00
Alexander Udalov dca6c21d7f Tests: remove duplicateJvmSignature diagnostic tests
All of these tests were actually copied to `testsWithJvmBackend` in
866f188120, but it's unclear why they were copied instead of moved. The
test runner for `testsWithJvmBackend` correctly runs the compiler
pipeline and obtains errors reported by the backend, as opposed to the
common diagnostic tests which have a very custom code, using parts of
the old JVM backend, to obtain these diagnostics.
2024-03-13 08:38:15 +00:00
Alexander Udalov 6ed06f4dac Tests: minor, move diagnostic test missingNames.kt
Looks like it was placed in the `duplicateJvmSignature` directory by
mistake.
2024-03-13 08:38:14 +00:00
Alexander Udalov 5be1ff1d5f Tests: minor, remove obsolete diagnostic tests
- `require.kt` was added to check JVM accidental override diagnostic
  when using the "traits with required classes" feature, which was
  removed a long time ago.
- `withErrorTypes.kt` was testing conflicting JVM declarations error (a
  backend diagnostic) in presence of error types -- not very useful
  scenario because the backend is not run when there's a frontend error.
2024-03-13 08:38:14 +00:00
Vladimir Sukharev 5fee662223 [Tests] Add test for KT-57391
^KT-57391
2024-03-12 18:10:10 +00:00
Artem Kobzar 46dc478c03 [K/Wasm] Reduce debug information for the internal Kotlin functions 2024-03-12 17:37:03 +00:00
Nikolay Lunyak d3dfbec01a [FIR] Report warnings for inconsistent visibilities of accessors
K1 didn't report diagnostics for accessors
of intersection overrides, so this change
prevents a BC.

^KT-66046 Fixed
2024-03-12 16:35:05 +00:00
Nikolay Lunyak 7ecbaf7d1e [FIR] Calculate property setters visibilities for intersections properly
Basically, just calculate them the same
way it's done for other members.

`chooseIntersectionVisibilityForSymbolsOrNull`
is named like this to prevent a JVM clash.

^KT-66046 Fixed
2024-03-12 16:35:05 +00:00
Nikolay Lunyak b7926b68ab [FIR] Fix sources of intersection override properties's accessors
^KT-66046
2024-03-12 16:35:05 +00:00
Nikolay Lunyak daa6e03e3b [FIR] Reproduce KT-66046
^KT-66046
2024-03-12 16:35:05 +00:00
Mikhail Glukhikh 0b34d66b87 Revert "FIR: Report CAPTURED_VAL_INITIALIZATION if initialization is done"
This reverts commit 1c4023fda5.

#KT-64854 Submitted
#KT-59906 Submitted
2024-03-12 15:58:34 +00:00
Ilya Chernikov 0fe793943d K2, REPL: Display a warning that LV 1.9 is used for REPL in K2
#KT-64384 fixed
2024-03-12 15:57:00 +00:00
Mikhail Glukhikh d897bfbcad Fix tests after a semantically conflicting merge of KT-50008 and KT-65596 2024-03-12 14:54:10 +00:00
Brian Norman c6c0abae82 [FIR] Create test case to validate KT-56988 is working as expected
^KT-56988 Fixed
2024-03-12 14:48:39 +00:00
Igor Yakovlev b839e2680e [Wasm] Fix equality on Nothing type
Fixed #KT-66104
2024-03-12 14:36:45 +00:00
Igor Yakovlev 7c16528560 [Wasm] PL tests implementation for Wasm target
Fixed #KT-58088
2024-03-12 14:36:45 +00:00
Igor Yakovlev 6b66195afc [Wasm] Enable PL support for lowerings 2024-03-12 14:36:45 +00:00
Igor Yakovlev ec1ade1293 [Wasm] Allow virtual functions signature clash for PL support 2024-03-12 14:36:45 +00:00
Igor Yakovlev 8851ccc35d [Wasm] Allow incomplete implementations for PL 2024-03-12 14:36:45 +00:00
Igor Yakovlev 1e798a2527 [Wasm] Implement IrLinkageError end enable partial linker
KT-58088
2024-03-12 14:36:45 +00:00
Ilya Chernikov 4fafa4b6e9 K2 IC: add lookups of candidates on tower level processing
Allow recording lookup to symbols from supertypes, required at least
for CRI.

partially fixes #KTIJ-29026
2024-03-12 11:38:07 +00:00
Ilya Chernikov 39b05a0a1c K2 IC: fix classifiers lookups
in particular nested classifiers and companions.

#KTIJ-24833 fixed
#KTIJ-24830 fixed
#KT-55195 fixed
2024-03-12 11:38:07 +00:00
Ilya Chernikov a823bfd600 K2 IC: refactor and optimize lookup tracking
- encapsulate semantic more into helpers
- allow lazy scopes iteration
- simplify reporting code in tower resolver
- fix some inconsistencies and wrong lookups
- remove redundant lookup recordings
- remove lookup scopes for non-star imports

The commit is a refactoring and doesn't change the behaviour of
neither IC nor CRI. Changes in the lookups are mostly due to the
previous obviously wrong lookups (see changed test data).
2024-03-12 11:38:07 +00:00
Ilya Chernikov fe4e0e9c2e K2 IC: fix class members lookups recording
in particular - statics

 #KTIJ-24830 fixed
2024-03-12 11:38:06 +00:00
Ilya Chernikov 1989e8f094 IC tests: add infrastructure for K1/K2 lookups comparison
Adapt lookup tests to allow running K1 and K2 on the same testdata
and compare the lookups recorded.
2024-03-12 11:38:06 +00:00
Ilya Chernikov 684d0b8690 K2 IC: filter out builtins lookups
Do not record lookups to kotlin builtins, since it is considered
useless.

Related to #KT-66417
2024-03-12 11:38:06 +00:00
Ilya Chernikov 5b62558798 K2 IC: fix member lookup recording
The previous code recorded only class name, instead of fqname,
as a scope of lookup.

#KT-65943 fixed
#KTIJ-24828 fixed
related to #KT-56197
2024-03-12 11:38:06 +00:00