Commit Graph

10378 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
Mikhail Glukhikh 95bf63d6cb K2: introduce OptIn language version checker
#KT-60598 Fixed
2023-07-24 12:50:38 +00:00
Mikhail Glukhikh 8c305d6143 K2: introduce infrastructure for LanguageVersionSettings checkers 2023-07-24 12:50:38 +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 59f1a0dd8e [FIR, IR] Refactor: move annotation retention helper functions
Will be needed in subsequent commit to be accessible in
ExpectActualMatchingContext implementations.

^KT-58551
2023-07-24 09:48:48 +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 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
Roman Efremov b1bdb619d8 [FE] Refactor: provide FirExpectActualMatchingContext as session component
This will be needed in subsequent commits because context must be
accessible from `:fir:checkers` module, but it is in `:fir:resolve`

Intermediate interface `FirExpectActualMatchingContext` is needed
because `FirExpectActualResolver` relies on some FIR-specific methods,
and providing common `ExpectActualMatchingContext` interface is not
enough.

Also in `FirExpectActualMatcherTransformer` context extracted to field
to not create context for each processed element. "session" made
final to calm down warning "accessing non-final property in
constructor".

^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
Svyatoslav Scherbina ef6dcd9779 Native, K2: add ExperimentalForeignApi to generated forward declarations
cinterop tool should add ExperimentalForeignApi to all generated
declarations, to indicate their experimental status and discourage using
them in public Kotlin API. But the same considerations are applicable
to forward declarations (cnames.*, objcnames.*), which are generated not
by cinterop tool, but directly by the compiler.

This commit adds ExperimentalForeignApi to those compiler-generated
classes.

^KT-58362
2023-07-21 17:44:09 +00:00
Zalim Bashorov b1a4d354f1 Regenerate tests 2023-07-21 17:27:17 +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
Kirill Rakhman e35a28d36d [FIR2IR] Correctly map arguments of type alias constructor call
Previously, we applied type arguments as is when converting type alias
constructor calls to IR.
Now, we map them using the expansion of the type alias.

#KT-59743 Fixed
2023-07-21 07:45:52 +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 b98dbf7b56 [FIR] Use singleOrNull instead of firstOrNull for WHEN_MISSING_CASES renderer 2023-07-20 11:04:18 +00:00
Ivan Kochurkin 529d5a1df2 [FIR] Add description to NO_ELSE_IN_WHEN and fill it for expect enum or sealed declarations 2023-07-20 11:04:18 +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 Kylchik 30c00f7983 [IR] Specify explicitly that classes from Java can be interpreted
In early prototypes of interpreter, it was easier to assume that
all classes from Java can be interpreted and fix something if not.
Check for Java declaration was done by checking that the package name is
starting with "java". But this is actually wrong and can lead to errors
when some code is declared in "java" something package, but is not from
Java stdlib.

#KT-60467 Fixed
2023-07-20 09:40:42 +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
Ivan Kylchik ecd20b1348 [JVM_IR] Properly handle inlined local var located in regenerated object
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 17e49fce75 [JVM_IR] Support basic fake var generation for IR inliner
#KT-58778
2023-07-20 09:01:42 +00:00
Ivan Kylchik 2ecbb21a9f [IR] Add new tests on inline to check issues with type parameters
#KT-58241
2023-07-20 09:01:42 +00:00
Kirill Rakhman 95005dae8a [FIR PSI] Set source of equality operator call
#KT-55835
2023-07-20 07:29:19 +00:00
Kirill Rakhman 9e9b92fd16 [FIR PSI] Set source of error reference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 070b694247 [FIR] Get rid of implicit type refs with source
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 91dad7b952 [FIR] Set source of smart-cast expressions automatically
#KT-55835
2023-07-20 07:29:18 +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 a55f3c5583 [FIR LT] Set source on FirExplicitSuperReference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman ccab42cd2a [FIR LT] Set source on FirExplicitThisReference
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman bed6cb7154 [FIR] Make FirFile.annotationsContainer nullable
Previously, when no file annotations were present, the FIR element
didn't have a source.
By making it nullable, it will only be created when appropriate and the
source will never be null.

#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman 311975f1ed [FIR] Set source on return expression in generated getters
#KT-55835
2023-07-20 07:29:18 +00:00
Kirill Rakhman ef086a4c88 [FIR] Eliminate null field in FirNoReceiverExpression
#KT-55835
2023-07-20 07:29:18 +00:00
Pavel Mikhailovskii fd07f7f43c [FIR] KT-60427 Don't generate outerType attributes for non-inner classes in FirElementSerializer 2023-07-19 15:27:03 +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 e69b695efd [FIR] Introduce common super type for context dependent resolution modes 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 51b9059123 [FIR] generate copy builder for annotation
^KT-60387
2023-07-19 11:50:12 +00:00
Kirill Rakhman 987867fe12 [FIR2IR] Fix crash caused by unresolved annotation argument in deserialized class
#KT-60181 Fixed
2023-07-19 11:07:11 +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
Kirill Rakhman c605cb9855 [FIR2IR] Align object receiver generation with K1
#KT-59548 Fixed
2023-07-19 10:39:41 +00:00