Commit Graph

254 Commits

Author SHA1 Message Date
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 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
Mikhail Glukhikh 00b4ae6ae9 K2: expand type before isSomeType checks properly
Related to KT-60229
2023-07-14 16:38:47 +00:00
Mikhail Glukhikh c839cd3c11 K2: don't use debugging type renderer in error messages 2023-07-13 09:07:39 +00:00
Denis.Zharkov e98890cece K2: Remove a bunch of unused declarations 2023-07-11 13:12:22 +00:00
Dmitrii Gridin f74d4494aa [LL FIR] fix designation path for synthetic declarations
A designation path for synthetic declarations like fake override
or member delegate contained the wrong FirFile, because it
was provided by the original declaration that is wrong.
So we should pick up the file from our path, because it shouldn't be
synthetic

^KT-59505 Fixed
2023-06-22 10:22:37 +00:00
Pavel Mikhailovskii 16644c1a3b FIR Preserve nullability of ConeErrorType when possible 2023-06-16 08:09:04 +00:00
Dmitriy Novozhilov 8b7cfcda10 [FIR] Add toString() methods to some ConeSubstitutor implementation
This is needed only for pleasant debugging
2023-06-09 22:51:31 +00:00
Kirill Rakhman a4c9a4f150 [FIR] Use optimized stdlib version of reversed list 2023-05-30 09:22:50 +00:00
Mads Ager a5157aa239 [FIR] Render attributes on function types.
Only render if there are non-compiler attributes to reduce
noise from extension function types.
2023-05-12 10:49:43 +00:00
Kirill Rakhman 0c3d5c11b1 [FIR] Render integer literal types as Int in diagnostic messages
#KT-55662 Fixed
2023-05-02 15:10:55 +00:00
Dmitrii Gridin 6b3e49e824 [AA FIR] correctly restore declaration with annotation with argument inside some type from symbol pointer
ConeAttributes can have some non-stable info, so we shouldn't render it

Also reduce resolve from IMPLICIT_TYPES_BODY_RESOLVE to TYPES where it is possible

^KT-58141 Fixed
2023-04-21 17:21:36 +00:00
Kirill Rakhman f08da86cfd [FIR] Improve comment for ConeIntersectionType 2023-04-20 08:12:49 +00:00
Kirill Rakhman 030866cb0b [FIR] Rewrite ConeKotlinType.hasError() using ConeKotlinType.contains() 2023-04-13 10:50:36 +00:00
Denis.Zharkov 1071669a92 Fix project K2-bootstrapping when KT-57609 breaking change is introduced 2023-03-29 10:45:40 +00:00
Nikolay Lunyak f644eb7988 [FIR JS] Implement FirJsExportDeclarationChecker 2023-03-29 08:51:48 +03:00
Kirill Rakhman 1f0d56e157 [FIR] Make type parameters inaccessible for non-inner nested types
#KT-57209
2023-03-28 13:20:53 +00:00
Nikolay Lunyak b385d787cc [FIR JS] KT-57200: Allow dynamic varargs
^KT-57200 Fixed
2023-03-13 15:54:52 +00:00
Denis.Zharkov a3dcc2032f Drop RawTypeMarker as it's effectively unused anymore
See the previous commits
2023-03-10 18:35:01 +00:00
Pavel Mikhailovskii 7700484a16 [AA] Fix conversion of annotation values 2023-02-22 13:55:50 +00:00
Denis.Zharkov 2b3f34cc52 K2: Fix false-positive type equality for different captured types
This is mostly a revert of 2f61a2f56f
There, we erroneously assumed that we may take captured types as equal
if they are based on the same-typed projections.

Each instance of capturing defines its own captured type,
that should not be equal to any other type captured in other place.

Initial motivation was brought by FP Ultimate, where a piece of code
from the new test was found that started working differently after
recent changes.

The most obvious consequence is the change in addAllProjection.fir.kt:
one cannot use an instance as an argument when expected type
is captured type based on the same instance.

Otherwise, it would lead to CCE if we allowed to put arbitrary charsequences
to the list that initially was a MutableList<String>

All other test data changes (but addAllProjection.fir.kt and differentCapturedTypes.kt)
are irrelevant and will be fixed in the subsequent commits
2023-02-15 08:13:52 +00:00
Denis.Zharkov dcdc48a233 K2: Support callable references adaptation on top-level
^KT-45989 In progress
^KT-54709 Related
^KT-55217 Fixed
2023-02-15 08:13:44 +00:00
Dmitriy Novozhilov 89c42e20c9 [FIR] Consistently use _function_ instead of _functional_ in names of classes and functions 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov 67aa80562d [FE] Completely replace FunctionClassKind with FunctionalTypeKind
FunctionalTypeKind can be used in FE 1.0 too, so there is no need to
  keep both classes. Also, removal of FunctionClassKind simplifies work
  with FunctionalTypeKind in common code, like Analysis Api
2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov 87a9103cc6 [FIR] Extract SyntheticFunctionsCache from builtins provider into separate one
This is needed because now set of available synthetic functional interfaces
  depends on session, because each module can contain different plugins,
  which provide different kinds of functional types
2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov e0c8f2354a [FIR] Properly implement FirFunctionalTypeKindService
This implementation takes additional functional type kinds from compiler
  plugins into account
2023-02-02 08:24:49 +00:00
Dmitriy Novozhilov c86495dcae [FIR] Introduce ConeFunctionalTypeKind as a replacement of FunctionClassKind
This is needed to provide an ability to extend different kinds of
  functional types

Also, cleanup and rename utilities related to functional types to avoid
  possible confusions
2023-02-02 08:24:49 +00:00
Dmitriy Novozhilov ed867af01d [AA LC] Expand aliases of type arguments during conversion to KtType
^KT-55781
2023-01-12 17:45:09 +00:00
Dmitriy Novozhilov bd26c29229 [FIR] Resolve arguments of error types during type resolution 2023-01-12 17:45:06 +00:00
Dmitriy Novozhilov c44993e586 [FE] Use FQN instead of KClass in TypeRegistry
TypeRegistry is the static map which contains mapping between type of
  session component and its index in the session array. Originally
  `KClass` of a component was used as a key in this map, which worked
  pretty well for compiler components. But there was a problem with
  components from plugins and Kotlin daemon: in compilation with daemon
  we keep TypeRegistry between compilations. But for each compilation
  we load plugins from jar, which brings to the situation when after N
  compilations there is N entries in TypeRegistry map with different
  KClass'es for same extension component. This not only causes AIOBE
  but also introduces the memory leak, because we keep reference to
  KClass which is not used anymore

So to fix this issue it's enough to just store FQN of component in
  TypeRegistry instead of KClass

There are no tests in this commit, but they will be added in next
  commit relevant to scripting. With those commits we will have gradle
  integration tests which uses Kotlin compiler daemon and registers
  a compiler plugin for scripting

^KT-55023 Fixed
2022-12-21 10:33:03 +00:00
pyos 02fedeb9ed FIR DFA: revalidate reassigned variables after loops
If a certain type statement is true on loop entry and all continue
paths, then it is also true on exit if the condition did not reassign
the variable.

^KT-7676 tag fixed-in-k2
2022-12-08 10:19:27 +00:00
Denis.Zharkov 5cc31114cd FIR: Support special scope for raw types
^KT-46369 Fixed
^KT-41794 Fixed
^KT-49351 Fixed
2022-10-31 14:28:50 +00:00
Dmitriy Novozhilov be3f8e7eb0 [FIR] Remove redundant opt-ins to ExperimentalStdlibApi in FIR modules 2022-10-19 11:09:33 +00:00
Mikhail Glukhikh e36091b926 K2: introduce even more readable renderer for types in messages
#KT-53343 Fixed
2022-09-13 09:05:48 +00:00
Dmitriy Novozhilov 671083c701 [Serialization] Implement serialization checker for K2 version of plugin
^KT-53178 Fixed
2022-09-07 07:57:38 +00:00
Mikhail Glukhikh 42b3adf33a Extract separate ConeIdRenderer and get rid of FirRenderer.RenderMode 2022-07-14 09:38:42 +00:00
Mikhail Glukhikh 7c27e6f843 FirRenderer: partially get rid of RenderMode 2022-07-14 09:38:37 +00:00
Mikhail Glukhikh a82baf87cb FIR renderer: extract separate ConeTypeRenderer 2022-07-14 09:38:33 +00:00
Mikhail Glukhikh 38f4a35be2 FIR: introduce flexible types pretty rendering for no arguments case
#KT-52020 Fixed
2022-06-29 16:50:05 +00:00
Mikhail Glukhikh 31ec10142b FirRenderer: add renderAllModifiers and renderDetailedTypeReferences
Related to KT-52020
2022-06-29 16:50:04 +00:00
Mikhail Glukhikh b2a9ad079d Fix unreachable branch in ConeKotlinType.render() 2022-06-29 16:50:03 +00:00
Jinseong Jeon b6371a5b9a AA/FIR: differentiate dynamic type rendering 2022-06-22 20:14:39 +02:00
Ivan Kochurkin 1a398e89ec [FIR] Add attributes to ConeErrorType for correct annotations resolving 2022-06-17 23:26:19 +00:00
Nikolay Lunyak be9e97d044 [FIR] Introduce ConeDynamicType 2022-06-02 13:47:23 +00:00
Denis.Zharkov 3967699430 FIR: Fix applying SAM conversion in case of DNN types
See org.jetbrains.kotlin.test.runners.codegen.FirBlackBoxCodegenTestGenerated.Sam.testPassSubtypeOfFunctionSamConversion

^KT-52152 Related
2022-05-19 16:54:03 +00:00
Denis.Zharkov 550d24f8c6 FIR: Introduce ContextFunctionTypeParams type attribute 2022-04-06 16:05:26 +00:00
Denis.Zharkov f3e28c3767 FIR: Prepare ConeAttribute infrastructure for non-singleton attrs 2022-04-06 16:05:25 +00:00
Dmitriy Novozhilov 52b72a7dac [FIR] Implement Int -> Long conversions for literals and operators over them
^KT-38895
^KT-50996 Fixed
^KT-51000 Fixed
^KT-51003 Fixed
^KT-51018 Fixed
2022-02-07 13:36:36 +03:00
Dmitriy Novozhilov b980f5ab32 [FIR] Introduce new kind of integer literal types for constant operator calls 2022-02-07 13:36:35 +03:00
Dmitriy Novozhilov 10c38ba47c [FIR] Reorganize cone type utilities
Make some overrides of members of Cone types final
2022-02-07 13:36:34 +03:00