Commit Graph

4950 Commits

Author SHA1 Message Date
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
Kirill Rakhman 8a90032e93 [FIR] Refactor deferred computation of callable copy return types
Rename some classes for clarity and move the implementations to the use
sites.
2024-03-12 10:29:43 +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
Ivan Kylchik e1180adfbd [Native] Always cast expression to the expected type after inline
Right now, during the process of inlining, the compiler erases types.
Because of that, we can end up with some random type
(for example, `Any`) where the concrete type was
expected (for example, `Int`). Compiler must insert a cast in the
required places.

#KT-66017 Fixed
2024-03-12 08:19:50 +00:00
Dmitriy Novozhilov 7a383373b0 [Test] Reproduce KT-65415 and KT-66432 2024-03-12 06:46:09 +00:00
Dmitriy Novozhilov d352cc9d96 [Frontend] Make DiagnosticSuppressor a project-level extension
Originally it was an application-level component, which caused non-trivial
  logic and cognitive load to carefully handle those extensions to avoid
  memory leaks.

6740a596 introduced a way to easily register `DiagnosticSuppressor` to
  project, and this commit continues this work, making it a proper
  project-level extension

A lot of changes caused by the fact, that this extension is needed to be
  obtained from `BindingContext` (see `BindingContextSuppressCache` and
  its usages), so almost all changes are introducing `Project` to
  `BindingContext`

^KT-66449 Fixed
2024-03-12 06:43:58 +00:00
Marco Pennekamp 5dec87eba8 [LL] Use soft references in FileStructureCache
- We can also soft-reference the `KtFile` key. Chances are, if the
  `KtFile` can be garbage-collected, we do not need a `FileStructure`
  instance for it either.

^KT-65978 fixed
2024-03-11 23:07:04 +00:00
Dmitrii Gridin 8de680314e [SLC] reuse toLightClass for inner classes creation
This means:
* We will call `checkCanceled` under the hood.
* We will cache and reuse the result of conversion.

^KTIJ-28688
2024-03-11 21:42:39 +00:00
Dmitrii Gridin 2f2a17f570 [SLC] inject checkCanceled into declarations creation to improve responsiveness
^KTIJ-28688
2024-03-11 21:42:39 +00:00
Dmitrii Gridin 0ab105f265 [LC] KotlinAsJavaSupportBase: add checkCanceled
The jump from Kt into the Psi world is a good place to check
if we have been canceled

^KTIJ-28688
2024-03-11 21:42:39 +00:00
Vadim.Mishenev df1d44b15f KT-64051 [AA] Fix resolve of KDoc references to a typealias by full name 2024-03-11 21:38:09 +00:00
Nikita Bobko 9d566465e6 [test] Run checkers in metadata-like style to see what diagnostics metadata compilation omits
Review: https://jetbrains.team/p/kt/reviews/14807

Technically, *.ll.kt should have been covering that. But I see that
there slight differences
2024-03-11 18:07:52 +00:00
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