Commit Graph

5973 Commits

Author SHA1 Message Date
Kirill Rakhman 8821f8d1a4 [FIR] Expand type alias when checking for type parameters from outer declaration
This fixes a false positive OUTER_CLASS_ARGUMENTS_REQUIRED when
referring to an inner class of a supertype that is extended using a
typealias.

#KT-62099 Fixed
2023-10-27 08:05:58 +00:00
Kirill Rakhman 907ebb36d0 [FIR] Filter out SAM constructors from MemberScopeTowerLevel
This tower level is for calls on a dispatch receiver, and it's not
allowed to call SAM constructors on a dispatch receiver.

#KT-60983 Fixed
2023-10-27 08:03:00 +00:00
Evgeniy.Zhelenskiy a77349edb4 [FIR] Report INAPPLICABLE_INFIX_MODIFIER on vararg parameter, position INAPPLICABLE_INFIX_MODIFIER on infix keyword
#KT-59974
2023-10-26 20:07:50 +00:00
Mikhail Glukhikh f82c3c3bf7 K2: add test confirming finished migration in KT-33917
Related to KT-62918, KT-60086
2023-10-26 19:41:13 +00:00
Mikhail Glukhikh dda7004d66 K2: add test to confirm behavior described in KT-62918
#KT-62918 Obsolete
Related to: KT-60086, KT-59920
2023-10-26 19:41:13 +00:00
Evgeniy.Zhelenskiy ce396f4ab6 [FIR] Add check inline declaration inside constructor calls
#KT-59933
2023-10-26 11:29:26 +00:00
Evgeniy.Zhelenskiy 6a5b356d30 [FIR] Add check of abstractness and existence of receiver parameters for lateinit var; add lacking lateinit modifier
#KT-59973
2023-10-26 11:08:27 +00:00
Anastasia.Nekrasova e789e08fb7 [K2] Disappeared FORBIDDEN_VARARG_PARAMETER_TYPE
^KT-59991
2023-10-26 10:51:48 +00:00
Ilya Goncharov 065733e87c [FIR] Add UNINITIALIZED_ENUM_ENTRY on access qualifier of local enum
^KT-59967 fixed
2023-10-25 15:36:11 +00:00
Alejandro Serrano Mena f227447837 [K2] Disallow named functions as expressions
^KT-62573 Fixed
^KT-59945 Fixed
2023-10-25 13:24:30 +00:00
Dmitrii Gridin 3941b05909 [FIR] do not transform annotations on delegated property accessors during implicit type phase
^KT-62874 Fixed
2023-10-25 08:59:15 +00:00
Dmitrii Gridin 1b636bf450 [FIR] add tests on annotations for delegated getter during implicit type phase
^KT-62874
2023-10-25 08:59:15 +00:00
Ivan Kochurkin d50c6f1b6d [FIR] Fix missing USELESS_CAST
`FirUselessTypeOperationCallChecker` always checks exact types matching for `as` operator

Simplify code of cast checker and utils

^KT-56629 Fixed
^KT-56615 Fixed
^KT-59820 Fixed
2023-10-24 20:59:56 +00:00
Dmitrii Gridin 2f8026f335 [LL FIR] add missed diagnostic tests for scripts
^KT-62840
^KT-62841
^KT-62861
2023-10-24 19:32:54 +00:00
Mikhail Glukhikh 3cb9396b20 K2: prefer derived class sources for callable copies (e.g. fake overrides) 2023-10-24 17:08:40 +00:00
Mikhail Glukhikh a9894b1842 K2: use derived class sources for callable copies if base callables have no sources
Related to KT-60155
2023-10-24 17:08:40 +00:00
Ivan Kochurkin bb937a8a21 [FIR] Initialize annotations in FirErrorTypeRef
^KT-62447 Fixed
^KT-62628 Fixed
2023-10-24 10:53:33 +00:00
Dmitrii Gridin a1ee07603a [FIR] add cfg dump to script test
^KT-62834
2023-10-24 10:30:55 +00:00
Kirill Rakhman 65ff684589 [FIR] Don't discriminate generics in conflict resolution for callable references
#KT-59430 Fixed
2023-10-24 07:27:07 +00:00
Anastasia.Nekrasova 9acae3b0df [K2] Disappeared ITERATOR_MISSING
^KT-59986
2023-10-23 07:56:02 +00:00
Ivan Kylchik 69a888b431 [FIR] Add diag test to verify const checker in Java world
Currently, this test is not working for FIR.

#KT-57802 Fixed
2023-10-20 16:33:21 +00:00
Nikita Bobko fa89b8b0f1 [FE 1.0] 2/2 Don't report a warning when new members are added to open expect actualization
^KT-62655 Fixed
2023-10-20 14:37:10 +00:00
Nikita Bobko 1d4ab50047 [FE 1.0] 1/2 Don't report a warning when new supertypes are added to open expect actualization
^KT-62655 Fixed
2023-10-20 14:37:10 +00:00
Nikita Bobko 12f932a63a [FE 1.0] Report a more precise diagnostic when parameter modifiers (vararg) are changed in actualization
^KT-62747 Fixed
2023-10-20 14:37:10 +00:00
Nikita Bobko 0f82baf841 [FE 1.0] 2/2 Drop AllowDifferentMembersInActual from compiler and testData
The annotation was dropped in the previous commit
2023-10-20 14:37:09 +00:00
Pavel Kirpichenkov 770332152b [LL] Don't register Java components for built-ins of non-JVM modules
This is the cause for the 'missing dependency supertype: Serializable'
issue: symbols from built-ins will have the additional Serializable
supertype provided by FirJvmDeserializationExtension that shouldn't
be used for non-JVM. In regular modules it is correctly not added by
the non-JVM sessions, leading to difference in supertypes and the error.

KTIJ-27449
2023-10-20 10:35:13 +00:00
Dmitrii Gridin d689c1a38f [FIR] FirJavaFacade: fix contract violation from annotations
`isJavaDeprecatedAnnotation` can't be used here because it triggers
the resolution of an annotation ClassId

^KT-62705 Fixed
2023-10-20 09:24:43 +00:00
Anastasia.Nekrasova 4f85cdbaed [K2] Disappeared COMPONENT_FUNCTION_MISSING
^KT-59941
2023-10-19 21:18:01 +00:00
Ilya Chernikov 268d058bbb Implement missing invoke resolution branch with context receivers
#KT-61937 fixed
Note: the current implementation only resolves for a single receiver
in each group. See KT-62712 and KT-62709 for the followup.
2023-10-19 19:39:31 +00:00
Nikolay Lunyak a0e9cc3206 [FIR] Fix new test data after merging a68a2409 2023-10-19 14:29:24 +00:00
Nikolay Lunyak a68a2409d3 [FIR] Remove the applicability filtering when reporting diagnostics
In case we don't want to introduce any new
abstractions like "user relevance for
applicability", we can just remove the
filtering.

^KT-62541 Fixed
2023-10-19 09:27:45 +00:00
Nikolay Lunyak fedadfb8db [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
K1 reports `ARGUMENT_TYPE_MISMATCH`
and `TOO_MANY_ARGUMENTS` together, and
one way to do it in K2 is to say that
their kinds of inapplicability difference
is not relevant to the user.

Note that K1 doesn't do such filtering,
so this change "makes K2 closer to K1",
but still different.

^KT-62541 Fixed

fixup! [FIR] Show ARGUMENTS_MAPPING_ERROR diagnostics along with INAPPLICABLE
2023-10-19 09:27:45 +00:00
Nikolay Lunyak 06b3c6ec13 [FIR] Reproduce KT-62541 2023-10-19 09:27:44 +00:00
Roman Efremov 601c517887 [FIR] Don't print function's default value parameters
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 0f0540cda0 [Test] Add test for reporting of function default value parameters
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 7893624589 [FIR] Remove debug labels in annotation arguments rendering
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 37a0dd9487 [FIR] Use idRenderer to print referenced class and callable ids
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.
Unlike in previous commit, this can't be fixed right in
`FirSymbolRenderer`, because `ConeIdRendererForDebugging` renders
differently and a lot of lazy resolve tests rely on that.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov 7f7801a7bc [FIR] Use idRenderer to render ClassId in qualifiers
It shouldn't break existing usages, because
1) default `ConeIdRendererForDebugging` renders ClassId in
same way as before the change;
2) I didn't find any usages, which use non-default idRenderer,
but rely on full ClassId be rendered for qualifiers.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov cb6ec46de1 [FIR] Fix type annotation arguments rendering inside symbols
...in ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic.

^KT-62585
2023-10-18 20:01:47 +00:00
Roman Efremov b3467353b2 [Test] Add test for ugly K2 reporting of annotation arguments
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message.

^KT-62585
2023-10-18 20:01:47 +00:00
Alejandro Serrano Mena b9b15cba08 [K2] Warn about deprecation and opt-in markers for overrides of Any
^KT-62620 Fixed

Include opt-in markers in the diagnostics
2023-10-18 12:34:58 +00:00
Dmitrii Gridin dfdd86da1f [FIR] do not capture class context during class annotations processing
^KT-62587
2023-10-17 20:32:11 +00:00
Dmitrii Gridin b03e3f0b0d [LL FIR] pass correct context during class annotation arguments mapping
The root cause of the problem is that we visit class annotations more
accurately than in the regular compiler transformer, so we have
a difference: the compiler assumes that annotation processing
of the class is called already inside this class, so it should enable
CLASS_HEADER_ANNOTATIONS mode to not capture extra context.
But we in LL FIR do this out of the class, so such context switching
is redundant and results in cutting out the outer class context

^KT-62587 Fixed
2023-10-17 20:32:11 +00:00
Dmitrii Gridin bbd09c6272 [LL FIR] add tests for nested class as annotation argument
^KT-62587
2023-10-17 20:32:11 +00:00
Evgeniy.Zhelenskiy 5b4731a780 [FIR] Fix local typealias visibility resolution
#KT-60026
2023-10-17 12:48:04 +00:00
Dmitriy Novozhilov 3b6ad36af1 [Test] Update/unmute tests after previous fixes
It's hard to tell which exact commit fixed each test
2023-10-17 12:46:28 +00:00
Dmitriy Novozhilov c3f3a4192c [FIR] Check supertypes hierarchy for java classes during creation of synhtetic properies
^KT-62394 Fixed
2023-10-17 12:46:28 +00:00
Vladimir Sukharev 242c1cf5f0 [FIR] Fix disappeared REPEATED_ANNOTATION for dynamic types
https://youtrack.jetbrains.com/issue/KT-59916/K2-Disappeared-REPEATEDANNOTATION
FirAnnotationChecker does not detect repeated annotation on dynamic type, since FirTypeResolverImpl wrongly did not convert source annotations to attributes of ConeDynamicType.
This MR improves FirTypeResolverImpl to convert attributes of FirDynamicTypeRef to annotations and attach them to ConeDynamicType.

Merge-request: KT-MR-12551
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-10-17 10:18:36 +00:00
Mikhail Glukhikh fd057ac68a FE: Add two more tests around KT-59561 2023-10-17 06:49:38 +00:00
Mikhail Glukhikh 9f6abfc166 K2/MPP: treat Array<Some> & Array<out Some> as similar types in annotations
#KT-59561 Fixed
Related to KT-61100
2023-10-17 06:49:38 +00:00