Commit Graph

6763 Commits

Author SHA1 Message Date
Brian Norman 42ebbb937c [FIR] Recursively search dependsOn modules in visibility checks
#KT-59071 Fixed
2023-07-24 14:20:57 +00:00
Roman Efremov cedfdbdc66 Fix test became invalid after KT-59739
^KT-58551
2023-07-24 14:25:26 +02:00
Artem Kobzar 53aa8eddfe [K/JS] Generate unstable names on Frontend-checks for declarations with the JsExport.Ignore annotation ^KT-60202 Fixed 2023-07-24 09:52:58 +00:00
Roman Efremov 6611a55a60 [FE] Relax rules of matching @Target annotation on expect and actual
Allow `expect` targets to be subset of `actual`.

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov ad84c83ee9 [FE] Skip more special annotations in KMP annotation matching
Many errors are reported in stdlib with these annotations
(SinceKotlin, Deprecated, so on).
But having them only on expect is a valid case. E.g. SinceKotlin added
if some old platform-specific API becomes commonized.

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 1dcdcee452 [FE] Add test for intrinsic const evaluation in KMP annotation matching
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 234f453173 [FE, IR] Don't check SOURCE annotations if actual declaration has no source
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 454756a2b5 [IR] Don't check annotations on expect/actual fake overrides
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 2980179bd7 [IR] Implement IR checker for expect actual annotations matching
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov b6cae1adcc [FE] Allow @OptionalExpectation to be present only on expect
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 1a4ab9bb4b [FE] Implement FE logic of expect actual annotations matching
This implementation only checks annotations set on expect/actual
declarations and requires further refinement (e.g. checking of other
annotation targets, class scopes within typealiases).

^KT-58551
2023-07-24 09:48:48 +00:00
Nikita Bobko 4f3ecedbca [FE] Stop ignoring ABSTRACT_MEMBER_NOT_IMPLEMENTED for expect classes
^KT-59739 Fixed
Review: https://jetbrains.team/p/kt/reviews/11038/timeline
2023-07-24 09:15:11 +00:00
Alexander Korepanov 89c3781c8e [JS FIR] Support NAME_CONTAINS_ILLEGAL_CHARS diagnostic
^KT-59392 Fixed
2023-07-21 13:54:34 +00:00
Alexander Korepanov 37c8ec1e51 [JS FIR] Support JS_BUILTIN_NAME_CLASH diagnostic
^KT-59391 Fixed
2023-07-21 13:54:34 +00:00
Dmitrii Gridin 8820867341 [FIR] support flexible types in ConeKotlinType#independentInstance
^KT-60580 Fixed
2023-07-20 17:22:56 +00:00
Nikolay Lunyak 84dd1acec1 [FIR] Check typealiases in supertypes
^KT-59830 Fixed

Merge-request: KT-MR-11187
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-07-20 12:50:06 +00:00
Ivan Kochurkin 8c39b2f71d [FIR] Report missing NO_ELSE_IN_WHEN for when statement with expect enums and sealed classes
^KT-59404 Fixed
2023-07-20 11:04:17 +00:00
Ivan Kochurkin d8ccf21894 [FIR] Fix false positive "suspension point is inside a critical section"
^KT-55072 Fixed
2023-07-20 10:38:59 +00:00
Ivan Kochurkin 43c66ee0e5 [FIR] Fix arguments mapping for indexed set operator
Now processPositionArgument changes STATE as well as processNamedArgument

^KT-59386
2023-07-20 09:38:28 +00:00
Ivan Kochurkin 8f5294a508 [FIR] Consider explicit returns during computing return type of anonymous function
Introduce FirAnonymousFunctionReturnExpressionInfo

^KT-59386
2023-07-20 09:36:55 +00:00
Kirill Rakhman 9288a96f6d [FIR] Assert source is not-null when reporting cone diagnostics
#KT-55835
#KT-59856
2023-07-20 07:29:18 +00:00
Kirill Rakhman 2f3293f99e [FIR] Skip redundant INAPPLICABLE_CANDIDATE on call with unresolved callable reference argument
A new resolution diagnostic UnsuccessfulCallableReferenceAtom is
introduced that is used in EagerResolveOfCallableReferences.
No diagnostic is reported on unresolved calls with this diagnostic
because

#KT-59856
2023-07-20 07:29:18 +00:00
Kirill Rakhman 97024d9ccb [FIR] Resolve array literal argument for non-primitive-array parameter as arrayOf call in annotation calls
This allows us to properly complete array literals arguments of
annotation calls fixing several false-negative type mismatch errors
as well as enabling the inference of generic type arguments.

#KT-59581 Fixed
#KT-58883 Fixed
2023-07-19 13:34:58 +00:00
Kirill Rakhman ff6b3350ae [FIR] Resolve array literal with non-primitive-array expected type as arrayOf call
This lets us properly complete the call which fixes some issues with
false-positive type mismatches.
This change doesn't apply to array literals in annotation calls yet
because they are resolved as context-dependent.
This will be adapted in a following commit.

#KT-59581
2023-07-19 13:34:58 +00:00
Dmitrii Gridin d0854d5b45 [FIR] propagate copy of original ConeKotlinType to anonymous functions to avoid concurrent modification
It is required to avoid leakage of annotations instance from
the original type
It should be enough to just create a new instance of an annotation
without a deep copy, because transformer shouldn't touch it

^KT-60387 Fixed
2023-07-19 11:50:12 +00:00
Dmitrii Gridin 4366164b65 [FIR] ConeAttributes: fix plus method
The 'plus' method was actually creating a new 'ConeAttributes' with
only one new attribute due to a typo inside 'buildList'

^KT-60451
^KT-60504
2023-07-19 10:40:03 +00:00
Ivan Kochurkin 5f1e2764c3 [FIR] Fix some missing EXPECTED_DECLARATION_WITH_BODY 2023-07-19 10:14:08 +00:00
Ivan Kochurkin 8f4a580c17 [FIR] Report EXPECTED_CLASS_CONSTRUCTOR_DELEGATION_CALL
^KT-59069 Fixed
2023-07-19 10:14:08 +00:00
Alexander Korepanov 08d158f901 [JS FIR] Support JS module system FE diagnostics
Support CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM diagnostic
^KT-59377 Fixed

Support CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM diagnostic
^KT-59381 Fixed

Support CALL_FROM_UMD_MUST_BE_JS_MODULE_AND_JS_NON_MODULE diagnostic
^KT-59417 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 6034d32d7c [JS FIR] Support DYNAMIC_NOT_ALLOWED diagnostic
^KT-59384 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov 39fba56de9 [JS FIR] Support PROPERTY_DELEGATION_BY_DYNAMIC diagnostic
^KT-59406 Fixed
2023-07-18 14:02:30 +00:00
Alexander Korepanov f6b7a07efe [JS FIR] Support EXTERNAL_INTERFACE_AS_REIFIED_TYPE_ARGUMENT diagnostic
^KT-59416 Fixed
2023-07-18 14:02:30 +00:00
Alexander Udalov 8fc6c03e16 Tests: merge firTestWithJvmBackend into testsWithJvmBackend 2023-07-17 16:55:24 +00:00
Alexander Udalov 9935519656 Tests: add RENDER_ALL_DIAGNOSTICS_FULL_TEXT directive
Use it in diagnostic tests with JVM backend instead of the
RENDER_DIAGNOSTICS_FULL_TEXT directive.

This is needed because otherwise in
AbstractDiagnosticsTestWithJvmBackend there are two handlers trying to
dump full diagnostic texts: JvmBackendDiagnosticsHandler and
FirDiagnosticsHandler, which dump different diagnostics (reported by
backend vs frontend) and in slightly different formats.

In fact, this is why exceptionFromInterpreter.fir.diag.txt was added in
48484368c7: the existing .diag.txt was detected as incorrect by
FirDiagnosticsHandler (even though the diagnostics are the same, just
printed in a different way), which led to the creation of .fir.diag.txt.
For these tests, the behavior about checking diagnostic text in
FirDiagnosticsHandler is useless because it doesn't include backend
diagnostics. So we disable it by using another directive.
2023-07-17 16:55:24 +00:00
Alexander Udalov dd3bebb690 Remove obsolete directives in diagnostic backend tests 2023-07-17 16:55:24 +00:00
Alexander Udalov 6f2bb8c05a Rename tests with diagnostics on JVM backend
Remove the "_ir" suffix. It was originally used to distinguish tests on
the JVM IR backend from the old JVM backend ("_old"), but the latter are
removed now.
2023-07-17 16:55:24 +00:00
Alexander Udalov 815ab15313 Remove JVM_OLD-specific test data from backend diagnostic tests
Old JVM backend is only used as a fallback in Evaluate Expression in the
IDE at this point, so it's supposed to compile only correct code anyway.
2023-07-17 16:55:24 +00:00
Alexander Udalov b03e50129e Tests: fix handling of diag.txt files in diagnostic tests with backend
Also take into account diagnostics reported via
GenerationState.collectedExtraJvmDiagnostics, and render them in the
similar format to KtDiagnostic.

Don't make the test pass if the reported list of diagnostics is empty,
because that defeats the purpose of the test.
2023-07-17 16:55:24 +00:00
Igor Yakovlev 78fa93d75c [Wasm] Restrict WasmExport functions for primitive typed signature 2023-07-17 14:01:13 +00:00
Kirill Rakhman 883102c4c6 [FIR] Always run expect actual matching for actual annotation/inline class primary constructor
Previously, we didn't run it when the primary constructor itself didn't
have the actual modifier even though the modifier is optional.

#KT-60120 Fixed
2023-07-17 12:06:37 +00:00
Brian Norman 363b336b7a [FIR] Only overridable members should report JvmName inapplicable
Instead of checking for only open declarations, check for overridable
declarations, since private declarations cannot be overridden even if
they are marked as open. While normally these modifiers are exclusive,
a declaration can be made open via a compiler plugin like AllOpen.

#KT-60183 Fixed
#KT-57223 Fixed
2023-07-17 12:06:09 +00:00
Pavel Kunyavskiy 6da3ecceab [K/N] Implement frontend checkers for usages forward declaration type
Forward declaration type doesn't exist in runtime. This restricts
its possible usages.

^KT-59764
2023-07-17 09:24:33 +00:00
Mikhail Glukhikh 51e8a72f47 K2: expand return type properly in FirReturnTypeChecker
#KT-60229 Fixed
2023-07-14 16:38:47 +00:00
Mikhail Glukhikh 402e1de5fe K2: reproduce KT-60229 2023-07-14 16:38:47 +00:00
Brian Norman d2ad426350 [FIR] Fix node ordering for delegating constructor graph
Inject delegated constructor and other in-place initializer sub-graphs
after the delegated constructor call node. This ensures property
initialization and use is calculated correctly when there are complex
calculations for the arguments to the delegated constructor.

#KT-59708 Fixed
#KT-59832 Fixed
2023-07-14 13:42:29 +00:00
Egor Kulikov 70d49999ac [FIR] Generate an error primary constructor when super call is invalid
Merge-request: KT-MR-11026
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-07-13 17:37:48 +00:00
Roman Efremov a79282cec1 [FE] Prohibit actual typealias to certain compiler annotations
^KT-58554
2023-07-13 16:12:59 +00:00
Ivan Kochurkin f4a648aa3e [K2, MPP] Fix NO_ACTUAL_FOR_EXPECT reporting for all modules including the platform ones
^KT-58483 Fixed
2023-07-13 16:01:26 +00:00
Stanislav Ruban 4f92008f01 [test docs] Actualize the README.md for diagnostic tests somewhat 2023-07-13 13:41:36 +00:00
Stanislav Ruban 5c644bcac8 [test infra] Add a directive for type checking utils that use @Exact 2023-07-13 13:41:36 +00:00