5034 Commits

Author SHA1 Message Date
Alexander Udalov 2f056fe155 JVM: remove StubClassBuilder and its usage
After legacy light classes were removed, the only remaining usage was in
KotlinLightClassBuilderFactory where we ran JVM backend in the
LIGHT_CLASSES mode, and that was only used from diagnostic tests to
report JVM backend diagnostics.

We don't actually need to build stubs here, so we can just use ASM's
class writer, which means that StubClassBuilder and all its dependencies
can be removed.
2024-03-11 18:03:49 +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 c966533d73 K2: reproduce a problem from intellij.vcs.git 2024-03-11 13:38:05 +00:00
vladislav.grechko 8a6467e524 [FIR] Add tests for KT-65184 to confirm its proper work
#KT-65184 Fixed
2024-03-11 13:38:05 +00:00
Mikhail Glukhikh 78b6432ced K2: don't make T = Type! substitutions for constructors, including SAM
Without this commit we get some ABI changes and it looks bad.

Related to KT-65596
2024-03-11 13:38:05 +00:00
Denis.Zharkov 81414d758d K2: repeat K1 representation for flexible type parameters
This commit changes the behavior of KT-59138 effectively declining it in 2.0.
However, we plan to implement KT-59138 behavior under a feature
flag in 2.0 (see KT-66447), and switch this feature on version 2.x.

Also, this commit implements the LC resolution about postponing
KT-57014 change. We don't have KT-57014 described behavior in 2.0 anymore.
However, we plan to implement a deprecation warning here, see KT-65578.

After this commit, 6 diagnostic tests become incorrectly broken:
- 5 tests from PurelyImplementedCollection group
- a test platformTypes/nullableTypeArgument.kt

This commit also breaks currently fixed-in-k2 KT-50134
(it is fixed again in the following commits),
as well as KT-58933 (it will remain not fixed till we enable KT-59138
behavior again).

#KT-65596 In Progress
#KT-57014 In Progress
#KT-58933 Submitted
2024-03-11 13:38:05 +00:00
Mikhail Glukhikh db173b8ac5 K1/K2: add test for Comparator.comparing situation from intellij 2024-03-11 13:38:05 +00:00
Mikhail Glukhikh 993509c057 K1/K2: add test for streams situation from intellij 2024-03-11 13:38:05 +00:00
Mikhail Glukhikh 6e1b6427ab K1/K2: add a test confirming current behavior of KT-57014 case 2024-03-11 13:38:05 +00:00
Roman Golyshev b765cf3f99 KT-66411 [AA] Add fake source kind for single expression block around array assignments
A wrapper block was introduced as a part of fixing KT-59748, but was
assigned a real source, which had `getOrBuildFir` confused because
of the incorrectly built `KtToFirMapping`

It is relevant for:
- `if`, `when` expressions with an assignment as a single expression
- Kotlin code fragments,
when the assignment is being analysed as a single expression
in the fragment

^KT-66411 Fixed
2024-03-10 15:35:47 +00:00
Roman Golyshev ec06654a73 KT-66411 [AA] Add test for the getOrBuildFir on array assignment expression as a single when/if branch expression 2024-03-10 15:35:47 +00:00
Roman Golyshev 83a80a45a9 KT-66411 [AA] Add more tests for resolving compound set operators 2024-03-10 15:35:47 +00:00
Anna Kozlova 943d829fa7 [AA] treat named arguments as write access
^KTIJ-16835 fixed
2024-03-08 22:12:25 +00:00
Nikolay Lunyak fbdf7e33bd [FIR] Ensure KT-50293 is no longer a problem
PCLA-related changes led to this change in
behavior. In K1 an explicit cast was needed
to prevent ORA, but now in K2 this code
is green without casts.

^KT-50293 Obsolete
2024-03-08 15:37:45 +00:00
Ivan Kochurkin 2d4f4b9bb5 [FIR] Disallow operators not on functions
Introduce `NOT_FUNCTION_AS_OPERATOR` and use it instead of `PROPERTY_AS_OPERATOR`

^KT-65881 Fixed

Merge-request: KT-MR-14547
2024-03-08 10:07:23 +00:00
Nikolay Lunyak 7f12af9452 [FIR] Ensure KT-66161 is not reproducible in the compiler
^KT-66161


Merge-request: KT-MR-14730
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2024-03-07 15:10:18 +00:00
Dmitrii Gridin 8cc2208c00 [LL FIR] support lazy resolution tests for scripts with custom definition
^KT-66276
^KT-66232
2024-03-07 12:50:59 +00:00
Dmitrii Gridin d5cfea330b [LL FIR] support parameters resolution
Script parameters now can be resolved independently of the script.
But, as parameters are part of the script, their resolve will be called
before the script.

^KT-66276 Fixed
2024-03-07 12:50:59 +00:00
Dmitrii Gridin 150af66b55 [LL FIR] implement diagnostic tests on custom script definitions
it is impossible to declare test data with another output yet
as `myScriptFile.test.ll.kts` won't be treated as custom definition as
it requires `test.kts` extension.

^KT-66232 Fixed
^KT-66276
2024-03-07 12:50:59 +00:00
Dmitrii Gridin 204465132f [LL FIR] AbstractLLFirBlackBoxCodegenBasedTestBase: unify logic
^KT-66232
2024-03-07 12:50:59 +00:00
Dmitrii Gridin dd0d2168fc [LL FIR] rename AbstractCompilerBasedTestForFir to AbstractLowLevelCompilerBasedTest
^KT-66232
2024-03-07 12:50:59 +00:00
Dmitrii Gridin d6b3f6f352 [LL FIR] AbstractCompilerBasedTestForFir: convert receiver to parameter
to allow using super call from implementations

^KT-66232
2024-03-07 12:50:59 +00:00
Dmitriy Novozhilov 4b5eac7816 [Test] Add regression tests for issues which are fixed in K2
Related issues:
KT-10879, KT-18055, KT-20617, KT-23873
KT-25668, KT-31191, KT-33108, KT-41013
KT-51827, KT-53886, KT-56624, KT-58447
KT-58458, KT-58751, KT-58814, KT-60597
KT-62806, KT-63258, KT-63444, KT-65101
KT-65408, KT-65844, KT-66186

^KT-65926 Fixed
2024-03-07 12:49:47 +00:00
Dmitriy Novozhilov b875ae774e [FIR] Unwrap captured types in target type of SAM conversion
^KT-66256 Fixed
2024-03-07 12:41:05 +00:00
Yan Zhulanow 690f39b91c [Analysis API] Minor, refactor 'createDumbVirtualFile()'
Pass the file name explicitly, and refine the dumb 'VirtualFile'
implementation.
2024-03-07 12:14:19 +00:00
Jinseong Jeon de4cce8dc8 AA: add support VirtualFile inputs to source module
^KT-65571 fixed
2024-03-07 12:14:19 +00:00
Jinseong Jeon 520ae725d1 Add test about dependsOn dependency and stdlib-common 2024-03-07 12:14:19 +00:00
Jinseong Jeon 6c062b0cea Add test about resolution to klib from non/common platforms 2024-03-07 12:14:19 +00:00
Jinseong Jeon 7f33097634 Fix typo in test input file name 2024-03-07 12:14:19 +00:00
Vladimir Sukharev a9af52c288 [Tests] Add test for KT-44199
^KT-44199 Fixed
2024-03-07 11:36:49 +00:00
Mikhail Glukhikh c04a8fc3b8 K1/K2: add test cases for KT-53792 and KT-66369 2024-03-07 10:25:11 +00:00
Jinseong Jeon f3ed9476a3 SLC: remove unused/redundant utils
KtTypeInfoProvider has many other variants like that,
e.g., KtType.(isUnit | isInt | isLong | ...)
2024-03-07 10:17:01 +00:00
Jinseong Jeon afd20b0c2d SLC: honor wildcard suppression on declarations
^KT-61734 fixed
2024-03-07 10:17:00 +00:00
Jinseong Jeon 9c16c52564 AA: pass wildcard suppression hints on declarations
^KT-61734
2024-03-07 10:17:00 +00:00
Jinseong Jeon d089db5a45 AA: honor wildcard suppression on type during type conversion
^KT-61734
2024-03-07 10:16:59 +00:00
Jinseong Jeon d4d2bae630 AA: add tests about wildcard suppress
^KT-61734
2024-03-07 10:16:58 +00:00
Anastasia.Nekrasova 1bb6f869a2 [K2]: Compiler crashes when array literal is used in delegate expression
FirCallResolver tries to find a
candidate for the delegate's getValue and cannot parse an arrayLiteral
with a nullable coneType.Running
FirCallCompletionResultsWriterTransformer.transformArrayLiteral is
required to find the result type. Therefore, completeCall should not be
invoked with the ResolutionMode from the 'data' param, but rather in
ResolutionMode.ContextIndependent.

#KT-65022 Fixed
2024-03-07 08:57:24 +00:00
Vladimir Sukharev b4bc576d37 [Tests] Add test for kt33411
^KT-33411 Fixed


Merge-request: KT-MR-14782
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2024-03-07 08:46:05 +00:00
Dmitrii Gridin 928fb94052 [FIR] fix internal error on suspend conversion with not-computed return type
^KT-62836 Fixed
2024-03-07 07:49:44 +00:00
Dmitrii Gridin f4096ae8e9 [FIR] add test case on more suspend conversion with more specific implicit type
^KT-62836
2024-03-07 07:49:44 +00:00
Dmitrii Gridin edd9f0348e [LL FIR] LLFirReturnTypeCalculatorWithJump: add checkCanceled
`tryCalculateReturnTypeOrNull` is the entry point for foreign symbols
resolution. We already have `checkCanceled` inside `lazyResolveToPhase`
and `checkIsResolved`, but in this case we will cover cases where
everything around is already resolved

^KTIJ-27504
2024-03-07 07:43:40 +00:00
Jinseong Jeon b47a33cf9d Back to getOrDefault test
The main purpose was to test getOrDefault w/ non/null value does not
bother the resolution. To be aligned with test file
mapGetOrDefault_nullable.kt, this one should test getOrDefault too.
All we needed was // WITH_STDLIB
2024-03-06 19:26:52 +00:00
Denis.Zharkov b7129f78a3 K2: Fix IAE at Candidate.updateSourcesOfReceivers inside PCLA lambda
Previously, it was failing at line
(resolvedReceiver?.toReference(session) as? FirNamedReferenceWithCandidate)?.candidate?.updateSourcesOfReceivers()

But this line was mostly incorrect because in case of `a.b()` call,
which is resolved to `a.b.invoke()`, `resolvedReceiver` is pointing to
`a` instead of obviously expected `a.b`.

The fix with using `candidate.callInfo.explicitReceiver` doesn't help
either because the candidate of that receiver is always completed at
that stage (so no Candidate there).

The only case when the candidate was still there is PCLA because
 in that case we explicitly don't fully complete even receiver
expressions.
(see docs/fir/pcla.md)

The idea of the fix is moving the call of `updateSourcesOfReceivers`
for invoke property receiver to the place just before the candidate
is being converted to the resolved reference
(i.e., the candidate is being lost)

^KT-66148 Fixed
2024-03-06 17:01:57 +00:00
Dmitrii Gridin 9ea9950d28 [LL FIR] Replace IGNORE_DIAGNOSTIC_API with IGNORE_NON_REVERSED_RESOLVE 2024-03-06 16:13:09 +00:00
Dmitrii Gridin 28c80a1581 [LL FIR] StubBasedFirMemberDeserializer: add missed deprecation provider
^KT-60996 Fixed
2024-03-06 16:13:09 +00:00
Dmitrii Gridin 805b7bc8f4 [Analysis API] add diagnostic tests on deprecated declarations
^KT-60996
2024-03-06 16:13:09 +00:00
Dmitrii Gridin 9cc2c22116 [Analysis API] drop obsolete tests
They were renamed during 2ce324f1fc,
but old wasn't dropped
2024-03-06 16:09:43 +00:00
Dmitrii Gridin 1ba81fca57 [Analysis API] add tests on incomplete function type parameter symbol
^KT-65858 Obsolete
2024-03-06 16:09:43 +00:00