Commit Graph

10880 Commits

Author SHA1 Message Date
Pavel Mikhailovskii 906c161068 KT-52791 Make it possible to pass multiple context receivers to a class 2022-12-28 11:21:03 +00:00
Evgeniy.Zhelenskiy ac28c0a286 [IR] Allow inline modifier for functions returning MFVC without warning
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-12-20 21:26:56 +00:00
Pavel Kunyavskiy 4928e284f6 Make LateinitIntrinsicApplicabilityChecker warning for Native and JS
This checker was enabled only on JVM by mistake.
It's now fixed, but we don't want to make it an error in minor release.
So it will be an warning in 1.8.20 and an error in 1.9.0

^KT-27002
2022-12-20 20:06:52 +00:00
Dmitriy Novozhilov bd3a28d04d [FE 1.0] Report INTEGER_OPERATOR_RESOLVE_WILL_CHANGE in missing cases
Covered places:
- local properties
- vars
- return positions of functions and lambdas

^KT-45970 Fixed
^KT-55358 Fixed
2022-12-09 15:10:03 +00:00
Dmitriy Novozhilov 3cffb33ab7 [FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1
  (because of not fully correct implementation) and unconditionally enabled
  in K2 (K2 does not support old behavior)

^KT-38895
2022-12-09 15:10:02 +00:00
Mikhail Glukhikh 29ad5f981c Extract EmptyIntersectionTypeKind.isDefinitelyEmpty to a property 2022-12-09 15:00:41 +00:00
Vladimir Dolzhenko b4aa2aef00 Add ability to invalidate AbstractResolverForProject
#KTIJ-23785

Merge-request: KT-MR-7900
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2022-12-09 12:04:50 +00:00
Alexander Udalov 60d96b7d15 Remove some leftover imports of unsafe cast functions 2022-12-06 19:44:56 +00:00
Steven Schäfer 21fef70367 Standardize context receiver parameter names
Previously, FIR used `_context_receiver_n` while FE10 used `<this>` for
all context receiver parameters. This commit changes the code in FE10
to follow the convention from FIR.
2022-12-03 00:11:38 +01:00
Evgeniy.Zhelenskiy fa4ceb4ef4 [IR] Add diagnostics to forbid annotations for MFVC-typed elements
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:39 +00:00
Evgeniy.Zhelenskiy adee33d3e5 [IR] Forbid MFVC primary constructors default arguments
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:38 +00:00
Evgeniy.Zhelenskiy 9f01ccc304 [IR] Support user-defined equals for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:36 +00:00
Evgeniy.Zhelenskiy 6107caa8e2 [FE1.0, FIR] Support secondary constructors for Value Classes
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:35 +00:00
Evgeniy.Zhelenskiy 0c70b60988 [IR] Add context receiver test on MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2022-11-30 18:55:33 +00:00
Yan Zhulanow 10fc86ef92 [FE] Add tests for 'containingClassForStaticMemberAttr' 2022-11-30 04:12:28 +00:00
Jinseong Jeon 8eccb552a3 Migrate descriptor-related util from IR to FE1.0
so that FE1.0 UAST can avoid depending on backend IR

^KTIJ-23602
2022-11-29 21:52:55 +00:00
Vladimir Dolzhenko f54e7abe1d Reduce memory footprint
#KTIJ-23785
2022-11-29 21:01:43 +00:00
Vladimir Dolzhenko e751b11b5e Add extra checks
#EA-721785
2022-11-28 15:20:29 +00:00
Vladislav Grechko cd6e865fb3 Improve support of 'lateinit' modifier
- Allow 'lateinit' for inline classes which underlying type
is suitable for 'lateinit'

- K2: report all problems related to 'lateinit' modifier

^KT-55052: Fixed
2022-11-24 19:47:21 +00:00
Mikhail Glukhikh f62bdb0e3d K1 opt-in: fix message/behavior for future error with WasExperimental 2022-11-23 12:00:08 +00:00
Mikhail Glukhikh 8ddc535caf Opt-in: forbid/deprecate constructor call with default arguments under marker
#KT-55074 Fixed
2022-11-23 12:00:07 +00:00
Vladimir Dolzhenko a8bef8ac81 Prevent unsafe publication of not full initialized instance
#KTIJ-22182
2022-11-22 15:24:38 +00:00
Roman Efremov 9330018390 Add comment with reference to K2 implementation of opt-in check
^KTIJ-23369 Fixed
2022-11-21 13:09:40 +03:00
vladislav.grechko 36b8ba8df3 Improve support of custom equals in inline classes
- Ensure that typed equals parameter's type is a star projection of
  corresponding inline class

- Make possible to declare typed equals that returns 'Nothing'

- Forbid type parameters in typed equals operator declaration

^KT-54909 fixed
^KT-54910 fixed
2022-11-17 15:35:14 +01:00
Mikhail Glukhikh ac514849f4 K1: add deprecation for implicit non-public calls #KT-54762 Fixed 2022-11-16 12:27:12 +00:00
Denis.Zharkov 2953e600ff K1: Deprecate incorrect callable references resolution behavior
^KT-54316 Related
^KT-54832 Fixed
2022-11-15 15:06:58 +00:00
Denis.Zharkov a3fd63fb1d Rename CompanionInParenthesesLHSCallChecker.kt -> CompanionLHSRelatedCheckers.kt 2022-11-15 15:06:58 +00:00
Yan Zhulanow ea3f550b58 [FE] Support analyzable files throughout all 'KtPsiFactory' API
Before, the only way of getting analyzable elements was to create an
analyzable file by using 'createAnalyzableFile()'. So made all utilities
available in 'KtPsiFactory' useless as they delegate to 'createFile()'
that always set the 'doNotAnalyze' flag.

The new behavior is to pass the 'analysisContext' instead if it is
passed to the 'KtPsiFactory' constructor.

The newly appeared API is going to be used in the Kotlin's UAST
implementation.
2022-11-11 11:28:34 +00:00
Vladimir Dolzhenko 2ec07b861b Add languageSetting provider
Access to facets could be heavy

#KTIJ-23501
2022-11-07 17:20:21 +00:00
Vladimir Dolzhenko 5dc2442872 Safe reporting PSI elements in KEWA 2022-11-03 17:27:11 +00:00
Sergej Jaskiewicz 37b32907ab Fix a compatibility issue with AnnotationDescriptor
The `getSourceForArgument` method should be in the interface,
but adding it is a breaking change for Java usages,
since the module is not built with -Xjvm-default (KT-54749).

Move the method to an extension. This doesn't change the behavior,
since it was only ever called on LazyAnnotationDescriptor.
2022-11-02 11:07:07 +00:00
Pavel Mikhailovskii 1215ae0fe7 KT-1436 Nicer compiler errors when the feature isn't supported 2022-10-31 13:49:57 +00:00
Nikita Bobko 4e69d1248a Cleanup: drop unused LanguageFeature.State.ENABLED_WITH_ERROR
Review: https://jetbrains.team/p/kt/reviews/7418
2022-10-27 13:16:10 +02:00
Mikhail Glukhikh 50cd560d09 K1: add more tests for BI assignment checker, fix corner cases
Related to KT-54004
2022-10-26 09:21:49 +00:00
Mikhail Glukhikh 87af855087 Use callElement instead of reportOn in BuilderInferenceAssignmentChecker
This commit fixes the breach in reportOn usage
Related to KT-54004
2022-10-26 09:21:49 +00:00
Mikhail Glukhikh 8e48636b29 K1: don't report assignment TYPE_MISMATCH in BI under feature ON
Related to KT-54004
2022-10-26 09:21:48 +00:00
Ilya Muradyan 352af4b245 Make the code compatible with IDE plugin 2022-10-20 16:00:42 +02:00
Ilya Muradyan 8d12342fc6 Add option for skipping calculating all names for optimizing reasons in LazyImportScope 2022-10-20 16:00:42 +02:00
Ilya Muradyan 4a58274056 Change PUBLICATION lazy to a storageManager one
Lazy computation in publication mode may lead to running of init code
many times in parallel, and it actually happens in IDE.
Instead, we stick to the option which is used for lazy computations
all across compiler code.
2022-10-20 16:00:42 +02:00
Ilya Muradyan b8260257fb [minor] Remove redundant qualifier name 2022-10-20 16:00:41 +02:00
Alexander Udalov d249b02cda Add JvmDefaultWithCompatibility to some interfaces
This has no effect on behavior, but will fix a binary compatibility
problem with Compose.

 #KT-54459 Fixed

Co-authored-by: Alexander Likhachev <Alexander.Likhachev@jetbrains.com>
2022-10-14 14:48:15 +02:00
vladislav.grechko 817afcd4af KT-MR-7307 review fixes 2022-10-13 15:19:10 +00:00
Denis.Zharkov 31ba1f1534 Add deprecation warning for false-negative TYPE_MISMATCH
See KT-49404 for details

In K1, within SubstitutingScope we approximate almost all the types
containing captured types are being approximated to either a lower or
an upper bound.

While mostly, it's being done correctly there are some problems with
approximations for flexible types

So, the parameter's type of A<in Any>::foo is approximated to Inv<in Any!>,
thus allowing to use Inv<*>, while it's obviously unsound.

NB: For the similar example, in B, there are regular TYPE_MISMATCH
because parameter for B<in Any>::foo is approximated to Nothing

Also, it's important to say that
- in K2 everything works because we don't use type approximation there
- approximation algorithm that works incorrectly is only being used in K1

^KT-54332 Fixed
2022-10-12 20:53:02 +00:00
Denis.Zharkov 4b455c0e51 Minor. Inject CallComponents to CallCheckerContext 2022-10-12 20:53:02 +00:00
Dmitriy Novozhilov d423782fac [FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors
- :core:descriptors.jvm
- :core:deserialization
- :compiler:cli
- :compiler:frontend
- :compiler:frontend:cfg
- :compiler:frontend.java
- :compiler:frontend.common.jvm
- :compiler:psi
- :compiler:resolution
- :compiler:resolution.common
- :compiler:resolution.common.jvm
- :kotlin-reflect-api
2022-10-12 13:58:56 +00:00
Mikhail Glukhikh 0080f16cc2 K1: report TYPE_MISMATCH for incorrect assignments in builder
#KT-54004 Fixed
2022-10-12 08:21:13 +00:00
Pavel Mikhailovskii f4bdf54601 KT-8575 Fix warnings for Java synthetic properties 2022-10-10 22:03:58 +00:00
vladislav.grechko e0c8142106 Support of custom 'equals' and 'hashCode' in inline classes
'equals' from any made available for overriding in inline classes
'typed' equals made available for definition in inline classes
'typed' equals definition made compulsory if 'untyped' is overridden
'operator' keyword is allowed in 'typed' equals definition

^KT-24874: Fixed
2022-10-10 16:52:34 +00:00
Ilmir Usmanov 808a73d5b9 FE: Change misleading error message 2022-10-05 11:51:20 +00:00
Artem Kobzar eb2326eabb [K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore. 2022-10-03 11:07:25 +00:00