2732 Commits

Author SHA1 Message Date
Ilya Chernikov d5ad41fa28 K2 Scripting: add failing test for #KT-64241 2024-03-19 15:38:35 +00:00
Kirill Rakhman 988edab7a0 [Tests] Add regression test for #KT-58575
#KT-58575 Fixed
2024-03-19 15:34:43 +00:00
Kirill Rakhman 72235b8527 [FIR] Report INNER_CLASS_CONSTRUCTOR_NO_RECEIVER on delegated constructor calls
#KT-59677 Fixed
2024-03-19 12:51:06 +00:00
Stanislav Ruban 89a0cde514 [tests][FIR][checkers] Add test data for KT-66595 2024-03-19 12:32:17 +00:00
Dmitriy Novozhilov f18aa5e70f [Test] Add regression test for KT-66638 2024-03-19 07:40:09 +00:00
Mikhail Glukhikh 2d755aabe7 K1/K2: add test data for KT-66356 2024-03-18 18:11:14 +00:00
Kirill Rakhman 19cc739118 [Tests] Reproduce #KT-65193 2024-03-18 15:52:50 +00:00
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
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 bf77cc3d0c [tests][FIR][checkers][JS] Add test data for KT-66474 2024-03-15 11:40:55 +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
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
Sergej Jaskiewicz 9851ff1905 [FIR] Reproduce KT-66277, KT-66279, KT-66512 and KT-66534 2024-03-14 18:34:30 +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
Alexander Udalov c997e9f142 Tests: move diagnostic test to testsWithJvmBackend
There's a difference in behavior of K1 and K2 here, see KT-66528.

 #KT-66528
2024-03-14 12:38:46 +00:00
Alexander Udalov 81a9f5654e Tests: remove diagnostic tests which are present elsewhere
- `typeParameterWithTwoBounds.kt` is already present in
  `diagnostics/testsWithJvmBackend/duplicateJvmSignature/erasure/`.
- `clashWithCompanionObjectField.kt` is already present in
  `codegen/box/fieldRename/jvmFieldNoClash1.kt`.
- `jvmFieldAndJavaGetter.kt` is already present in
  `codegen/box/jvmField/noClashWithInheritedJavaMethod.kt`.

In case of two latter tests on JvmField, there's (correctly) no error
reported in JVM IR, which is why those are box tests.
2024-03-14 12:38:44 +00:00
Dmitriy Novozhilov c62fe0d107 [Test] Add regression test for KT-66336 2024-03-14 12:23:36 +00:00
Kirill Rakhman 9f750d3036 [Tests] Reproduce current behavior of operator/infix resolution
#KT-66504
#KT-66453
#KT-58260
2024-03-14 11:32:38 +00:00
Nikita Bobko a8275c99a3 [FIR, IR] Check for strict subtypes during actualization
^KT-65775 Fixed
Review: https://jetbrains.team/p/kt/reviews/14906/timeline
2024-03-14 10:53:43 +00:00
Kirill Rakhman 786c37286c [FIR] Fix crash caused by cast of raw type to simple type
#KT-66552 Fixed
2024-03-14 08:42:20 +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
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 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
Kirill Rakhman 43a08068fc [Tests] Add regression tests for KT-32754
#KT-32754 Fixed
2024-03-13 12:39:54 +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
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 daa6e03e3b [FIR] Reproduce KT-66046
^KT-66046
2024-03-12 16:35:05 +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
Kirill Rakhman 973e337bf5 [FIR] Enhance getter overrides based on overridden properties
The following tests are failing with exceptions and will be fixed in the
following commits

j+k/testKjkPropertyAndExtensionProperty.kt
j+k/testKjkImplicitReturnType.kt

#KT-62118 Fixed
2024-03-12 10:29:45 +00:00
Kirill Rakhman 888cac6fc0 [Tests] Reproduce #KT-66048 2024-03-12 10:29:45 +00:00
Kirill Rakhman 29a9d3cdd9 [FIR] Fix copy paste error in receiver enhancement 2024-03-12 10:29:44 +00:00
Vladimir Sukharev aa1cce78c3 [FIR] Incorrect warnings about inline function impact
^KT-65959 Fixed
2024-03-12 10:26:23 +00:00
Denis.Zharkov 141be17b4b K2: Add some more tests showing the state for KT-64840
lambdaParameterForBareTypeEarlyFixationAffectsBehavior.kt
should show in the future commits how early variable fixation
necessary for bare type information might affect inference results

^KT-64840 Related
2024-03-12 10:22:11 +00:00
Ilya Gorbunov fc13ae7b4d [stdlib] Specify AT_MOST_ONCE contract for default-value-like functional parameters KT-54879 2024-03-11 18:12:27 +00:00
Mikhail Glukhikh 633e96b966 K1/K2: add test for Future.get case 2024-03-11 13:38:05 +00:00
Mikhail Glukhikh 266669272d Rename/move/mark the test for KT-65184 2024-03-11 13:38:05 +00:00
Mikhail Glukhikh 98e4c64360 K1/K2: add more tests around intellij.vcs.git example 2024-03-11 13:38:05 +00:00
Mikhail Glukhikh d04625666a K2: don't approximate captured types in ResultTypeResolver in certain cases
To be more precises, ResultTypeResolver for K2 now searches for
similar LOWER/UPPER constraints pair based on the same flexible type,
like LOWER(CapturedType&Any..CapturedType?) and UPPER(CapturedType!).
If such a pair is found, the CapturedType is not approximated.
This is done to avoid a big difference between this case and
completely same constraints, like LOWER(CapturedType!) and
UPPER(CapturedType!). In this case we squash them to EQUAL(CapturedType!)
even before ResultTypeResolver, and captured types which is got from
an EQUAL constraint are not approximated even before this commit.

This commit fixes back a case from KT-50134 and a problem with intellij.vcs.git

#KT-65596 Fixed
2024-03-11 13:38:05 +00:00
Mikhail Glukhikh c966533d73 K2: reproduce a problem from intellij.vcs.git 2024-03-11 13:38:05 +00:00