Commit Graph

1026 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 89c42e20c9 [FIR] Consistently use _function_ instead of _functional_ in names of classes and functions 2023-02-02 08:24:52 +00:00
Mikhail Glukhikh 565adf3075 K1: don't filter Enum.entries in tower to report error later
After this commit we:
- preserve Enum.entries synthetic property in tower even in case the bound feature is OFF
- report an error on Enum.entries call in specific checker if the feature is OFF
- give this synthetic property lower priority, no matter feature ON or OFF

#KT-55251 Fixed
2023-01-24 12:45:59 +00:00
Dmitriy Novozhilov 32f6b71525 [FE] Add ability to configure PublicDeclaration type approximation configuration
This configuration allows to choose what to do with local and anonymous types
2022-11-22 15:46:18 +00:00
Mikhail Glukhikh d41c1e7e99 Code cleanup: ExpectedActualResolver 2022-11-17 22:28:04 +00:00
Mikhail Glukhikh 82f1535007 K1: fix IIOBE in expect-actual checker with different type parameter number
#KT-54827 Fixed
2022-11-17 22:28:04 +00:00
Ilya Muradyan 8d12342fc6 Add option for skipping calculating all names for optimizing reasons in LazyImportScope 2022-10-20 16:00:42 +02: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 e9bb0f4fda Resolution: extract projections from captured flexible type properly
#KT-54100 Fixed
Related to KT-54196, KT-54198
2022-09-28 15:29:43 +00:00
Vladimir Dolzhenko b2b88662d8 Clean up
#KTIJ-23032
2022-09-27 15:17:27 +00:00
Dmitry Khalanskiy 4cbee3cde7 Fix KT-51478
The issue was that, when various context elements were available
to fulfill a need for an extension receiver, but none of them were
applicable to it, the compiler behaved the same way as if there
was no extension receiver at all.

https://youtrack.jetbrains.com/issue/KT-51478/Inapplicable-receiver-diagnostic-expected-when-there-are-two-context-receiver-candidates
2022-09-20 10:32:32 +00:00
Mikhail Glukhikh c4a48927d2 K1: report ABSTRACT_SUPER_CALL(_WARNING) also for 2+ steps to intersection
#KT-53953 Fixed
2022-09-16 07:15:43 +00:00
Mikhail Glukhikh 5fcb18ac2b Revert "[FE 1.0] Resolve this and super calls through the new type inference infra"
This reverts commit bab8047bb3.
2022-09-13 09:09:01 +00:00
Mikhail Glukhikh 393e99fa44 FE: don't run overload-by-lambda-return-type with unsuccessful candidates
Related to KT-52927
2022-09-09 16:12:24 +00:00
Mikhail Glukhikh e02fd8f4a8 FE: don't run builder inference in UNTIL_FIRST_LAMBDA mode
#KT-52927 Fixed
2022-09-09 12:44:39 +00:00
Mikhail Glukhikh 3bdd52b64a [FE 1.0] Return to the old type intersection emptiness check
This reverts commit 8227c4b603.
#KT-53656 Fixed
2022-09-06 17:57:01 +00:00
Simon Ogorodnik 05d486d55a Fix receiver inconsistency when builder inference restriction disabled
In 154e53c701 update of
extensionReceiverArgument in resolvedCall was accidentally moved into
language feature dependant block
2022-09-05 10:07:41 +00:00
Denis.Zharkov 42c41a1916 Revert "[FE 1.0] Build captured type's supertypes in an alternative way: use own projection type as a first supertype, then supertypes from the corresponding type parameter's upper bounds"
This reverts commit eb19d39cbf.
2022-08-30 15:56:30 +00:00
Simon Ogorodnik 154e53c701 K1: add diagnostic BUILDER_INFERENCE_STUB_RECEIVER
It's reported on receivers in extension function calls with stub type,
as such calls can shadow members of finalized stub types causing
change of resolve when corresponding type argument specified explicitly

It works by checking extension receiver during call resolution parts run
That way we can easily detect if we found an extension applicable to
stub receiver and report call diagnostic for it

KT-53739
2022-08-30 10:19:26 +00:00
Simon Ogorodnik 105358dcf6 K1: add diagnostic BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION
Let's call builder lambdas (BL) a lambda that has non-fixed input type
projection at the moment of lambda arguments analysis, such lambdas
is a subject to be analyzed with builder inference
Due to bug in constraint system joining algorithm, currently system
of two or more such lambdas may lead to unsound type inference

Diagnostic added here should be reported in case when there are two
BL that shares a common constraint system, while not annotated with
@BuilderInference, as a protection against aforementioned bug

It's reported by ConstraintSystemCompleter when such situation has
occurred during builder inference phase, it is the same place that
decides wherever lambdas is subject to builder inference or not

KT-53740
2022-08-30 10:19:25 +00:00
Mikhail Glukhikh b78106e437 Don't report INFERRED_..._INTO_EMPTY_INTERSECTION with explicit arguments 2022-08-19 14:01:38 +00:00
Victor Petukhov 8227c4b603 [FE 1.0] Use the new type intersection emptiness check
Also introduced compatibility mode to preserve compatibility for is/as/equality checks

^KT-29316 Related
2022-08-02 10:29:37 +00:00
Mikhail Glukhikh 3e58c54da9 Add docs to CandidateApplicability, remove DSL_SCOPE_VIOLATION 2022-07-27 15:29:48 +00:00
Mikhail Glukhikh d0c518013a Document&use CandidateApplicability.shouldStopResolve/isSuccess properly 2022-07-27 15:29:47 +00:00
Mikhail Glukhikh 0611f3b8e7 CandidateApplicability: add K1/K2 prefixes when applicable 2022-07-27 15:29:44 +00:00
Mikhail Glukhikh 32a73968de Stop tower resolve in K2 in more similar manner with K1 2022-07-27 15:29:41 +00:00
Victor Petukhov bab8047bb3 [FE 1.0] Resolve this and super calls through the new type inference infra
^KT-48961 In progress
2022-07-22 16:03:48 +00:00
Victor Petukhov 3ed87c29c7 [FE 1.0] Substituted possible fixed type variables after completion in accordance with @OverloadResolutionByLambdaReturnType
^KT-48031 Fixed
2022-07-04 12:05:57 +00:00
Victor Petukhov 9e8ef56cca [FE 1.0] Imitate having builder inference annotation while trying resolve with a builder inference
^KT-52892 Fixed
2022-06-21 15:02:31 +02:00
Victor Petukhov eb19d39cbf [FE 1.0] Build captured type's supertypes in an alternative way: use own projection type as a first supertype, then supertypes from the corresponding type parameter's upper bounds
The original case provoked forking a constraint system which isn't supported in K1 (K2 only). If the captured type is recursive, then type parameter's upper bounds may break subtyping due to substitution the current captured type again, into a recursive type parameter.

Note that we already have special logic for recursive captured types. See `isTypeVariableAgainstStarProjectionForSelfType`.

^KT-52782 Fixed
2022-06-18 14:04:40 +02:00
Mikhail Glukhikh d44f180aa9 FE 1.0: deprecate resolve to property when enum entry is at same level
See also KT-52802
#KT-49200 Fixed
2022-06-15 17:19:59 +00:00
Mikhail Zarechenskiy 372879b8e7 [FE 1.0] Don't fail with exception on unresolved type with type argument
^KT-50223 Fixed
2022-06-09 08:03:35 +00:00
Victor Petukhov b472ccd358 [FE 1.0] Introduce deprecation of inferred type variable into a declared upper bound within a builder inference call 2022-05-31 14:13:29 +00:00
Victor Petukhov 867ad24c86 [FE] Show causing types in the INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION diagnostic 2022-05-27 15:14:24 +00:00
Victor Petukhov 6a34b184ac [FE] Introduce warnings on possible empty intersection types, and improve errors reporting in general
^KT-52361 Fixed
2022-05-27 15:14:23 +00:00
Victor Petukhov e133ee3765 [FE] Cache checking intersection type emptiness results 2022-05-27 15:14:23 +00:00
Victor Petukhov 02a430875f [FE 1.0] Don't fail candidates which were marked with compatibility resolve previously
^KT-52431 Fixed
^KT-52393 Fixed
2022-05-27 15:14:22 +00:00
Victor Petukhov 0199c76c06 [FE 1.0] Check callable reference return type safety during resolution
^KT-51844
^KT-52503 Fixed
2022-05-27 13:56:34 +00:00
Victor Petukhov 51551998c7 Revert "[FE 1.0] Take care callable reference candidates with recursive candidate return type"
This reverts commit d04beaa8bb49c99ceb993f3f7b32169c393b39f4.
2022-05-27 13:56:33 +00:00
Denis.Zharkov ce1229038d Minor. Touch files erroneously not being recompiled by IC
^KT-52137 Related
2022-05-19 16:54:01 +00:00
Dmitriy Novozhilov 4d5a4ccd6b [FE 1.0] Don't fail on calls of functions with contracts from object
^KT-51704 Fixed
2022-05-19 07:14:22 +00:00
Anastasia.Shadrina d857142514 KT-51243 Fix parameterized contextual lambda
^KT-51243 Fixed
2022-05-17 15:27:26 +00:00
Victor Petukhov 9f31f074da [FE 1.0] Take care callable reference candidates with recursive candidate return type
^KT-51844 Fixed
2022-05-09 19:23:43 +00:00
Victor Petukhov 6027c2a9aa [FE] Substitute fixed type variables with inferred stub types
Actually, a type variable might be fixed into a stub type. Such stub type should be substituted before sub calls completion

^KT-51988 Fixed
2022-05-09 12:38:37 +00:00
Victor Petukhov 73be9d0a20 [FE] Don't check intersection emptiness if there were lower constraints 2022-04-27 19:50:30 +00:00
Victor Petukhov 12a39d0330 [FE 1.0] Report errors due to inferred empty intersection on those candidates which were already previously discriminated by CompatibilityOfTypeVariableAsIntersectionTypePart 2022-04-27 19:50:26 +00:00
Victor Petukhov e0a1f1c405 [FE] Review fixes 2022-04-27 19:50:24 +00:00
Victor Petukhov c71ae4301c [FE 1.0] Get rid of absolute CompatibilityOfTypeVariableAsIntersectionTypePart 2022-04-27 19:50:24 +00:00
Victor Petukhov 47d6236a2d [FIR] Support determining emptiness of an intersection type with type parameters' types 2022-04-27 19:50:23 +00:00
Victor Petukhov e7bd464a3c [FE 1.0] Check if type variable is bounded in upper by incompatible types (resolution stage)
^KT-51221 Fixed
2022-04-27 19:50:19 +00:00
Victor Petukhov 9e9e0211eb [FE] Check if type variable is fixed into an empty intersection type and report resolution warnings/errors if needed (completion stage)
^KT-51221 Fixed
2022-04-27 19:50:18 +00:00