Commit Graph

437 Commits

Author SHA1 Message Date
Denis.Zharkov 2bafcddf7a K2: Avoid using Nothing? as inference result in the majority of cases
Namely, do not choose `Nothing?` result type when fixing a variable
that has other constraints besides the ones that came from
the relevant type parameter's upper bounds.

See more details in KT-55691.

In K1, the case from specialCallWithMaterializeAndExpectedType.kt
was working (inferred to String?) just because the branches
were analyzed independently with `String?` expected type.

This change became necessary after the previous commit when we united
inference subsystems for if/when branches (see motivation there).

NB: For K1, the behavior is left the same, but the code
was refactored a bit.

^KT-55691 Fixed
^KT-56448 Fixed
2023-02-15 08:13:50 +00:00
Marco Pennekamp 9a693fa967 [FIR] Update backend tests with actual/expect in same module
- The fix for KT-55570 caused some backend tests to fail, because errors
  are now correctly reported for simple classes and actual/expect in
  the same module is not supported in FIR. See KT-55177.
- The commit also adds separate tests for K2. Unfortunately, these have
  to be disabled for K1 because K1 then reports "expect without actual"
  errors.
2023-01-30 17:17:58 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Mikhail Glukhikh b867fd8c2f FIR2IR: set CATCH_PARAMETER origin for catch parameters 2023-01-25 12:31:35 +00:00
Kirill Rakhman 69f2e8826a FIR: fix a bunch of issues after DiagnosticsReporter refactoring related to reporting diagnostic on null source 2023-01-11 08:30:36 +00:00
pyos 803abfeba8 FIR: rewrite lambda return type inference
* `return` should only be added to the last statement if the return
   type is not Unit

 * If there is a `return` without an argument, then the expected return
   type is Unit and the last expression is not a return argument (unless
   it's an incomplete call, in which case it is inferred to return Unit;
   this behavior is questionable, but inherited from K1)

 * There should be a constraint on return arguments even if the expected
   type is Unit, otherwise errors will be missed

 * When the expected type is known, using the call completion results
   writer is pointless (and probably subtly wrong).

^KT-54742 Fixed
2023-01-10 15:40:45 +02:00
Pavel Mikhailovskii 906c161068 KT-52791 Make it possible to pass multiple context receivers to a class 2022-12-28 11:21:03 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +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
Steven Schäfer a7ba081d22 FIR: Fix interface delegation ABI
- Unifies the name of the `$$delegate_<n>` field between K1 and K2.
- Make the `$$delegate_<n>` field private
2022-12-02 21:54:18 +00:00
Sergej Jaskiewicz aa1b18b0c8 [IR] Prevent infinite recursion when rendering bound symbol references
Refactor the renderer, make BoundSymbolReferenceRenderer a static class
to prevent calling RenderIrElementVisitor's methods from it to avoid
infinite recursion in the future.

^KT-52677 Fixed
2022-11-28 16:43:53 +00:00
Ivan Kochurkin 8883de3f00 [FIR] Don't resolve Enum.declaringClass and Enum.getDeclaringClass
^KT-53946 Fixed
2022-11-23 18:29:29 +00:00
Dmitrii Gridin 33281770c7 [FIR IR] support FirReceiverParameter
^KT-54417
2022-11-17 09:50:11 +00:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Dmitriy Novozhilov 6623456d2a [FIR] Properly support @JvmRecord
^KT-53867 Fixed
2022-10-03 15:48:17 +03:00
Dmitriy Novozhilov c0ad67c4f9 [FIR] Generate java declarations for record components of java records
^KT-53964 Fixed
2022-10-03 15:48:17 +03:00
Nikita Nazarov bd742bb95c Account for context class receivers when creating the ExpressionReceiver
^KT-54084 Fixed
2022-09-28 18:59:56 +04:00
Denis.Zharkov 7f7e5c5975 FIR: Fix candidate receivers orders when choosing a context receiver
^KT-53257 Fixed
2022-07-25 15:11:29 +00:00
Mikhail Glukhikh 2880cd8d5a FIR2IR: provide more precise conversion type context at some use-sites 2022-07-06 10:02:11 +00:00
Pavel Mikhailovskii c3c09aa95a KT-4107 Data objects 2022-06-28 16:58:20 +02:00
Ivan Kochurkin 157eedca43 [FIR2IR] Create IrConst instead of IrGetField for default value param in annotation class, ^KT-52676 Fixed 2022-06-17 23:26:20 +00:00
Ivan Kochurkin e004c8e2d6 [FIR2IR] Pass value parameter name to createDefaultSetterParameter if it exists 2022-05-29 23:41:25 +03:00
Ivan Kochurkin ad7c213ab2 [FIR] Initialize type for annotation arguments during deserialization
Get rid of IrErrorTypeImpl creating in FIR2IR
2022-05-29 23:41:23 +03:00
Denis.Zharkov 9676cd26cf FIR: Adjust Fir2IrText test data 2022-05-19 16:54:04 +00:00
Georgy Bronnikov 8fd29a9fec Fir2Ir: properly compute setter type parameter bounds 2022-05-19 12:02:44 +02:00
Ivan Kylchik 51ccc32a3f Update test data after introducing IntrinsicConstEvaluation annotation 2022-05-18 21:19:57 +03:00
Anastasia.Shadrina a3fa2dc9bf [Tests] Fix contextualInlineCall.kt to avoid subtyping relation error 2022-05-17 15:27:27 +00:00
Denis.Zharkov e632689d90 FIR2IR: Fix case of using context receivers in property initializers 2022-05-13 18:04:02 +00:00
Ivan Kochurkin 8c7fad9a5e [FIR] Support of type arguments in annotations ^KT-48444 Fixed 2022-04-18 15:36:19 +00:00
Denis.Zharkov 66bd8dccfa FIR: Unignore all Fir2IrText tests on context receivers 2022-04-06 16:05:40 +00:00
Pavel Kunyavskiy 7ba4d9e1f0 Rework nullability in IR 2022-03-30 06:27:59 +00:00
Alexander Korepanov 69295f2cf0 [JS IR] IC invalidation refactoring
- Huge refactoring for IC
  - Update hash combination logic
  - Introduce value class for IC hashes
  - Calc md5 directly by function IR
  - Split IC logic by classes
  - Move JsIrLinkerLoader into separate file
  - CacheUpdateStatus is a sealed class
  - Render TYPE_PARAMETER reified flag

^KT-51081 Fixed
^KT-51084 Fixed
2022-03-15 05:34:19 +00:00
Anastasia.Shadrina 4b366ddcf6 [BE JVM] KT-51271 Set proper indices generating contextual inline call
[Tests] Test inline call with context receivers and default params
2022-02-18 15:55:43 +03:00
Ivan Kochurkin 8a8bdc9ff4 [FIR2IR] Fix synthetic property reference in delegate expression 2022-02-07 17:21:58 +03:00
Mikhail Glukhikh 983fa4c8c7 FIR: add temporary access to Enum.getDeclaringClass (see KT-49653) 2022-01-27 17:27:39 +03:00
Evgeniy.Zhelenskiy e97ca2ada4 [Psi2Ir, Fir2Ir] Generate toString, hashCode, equals methods for MF VC 2022-01-14 13:51:57 +00:00
Ivan Kylchik b131c52889 Drop all usages of WITH_RUNTIME directive 2021-12-13 18:07:11 +03:00
Mikhail Glukhikh e591f79533 FIR2IR: fix origins for anonymous functions & lambdas 2021-12-09 13:26:41 +03:00
Dmitriy Novozhilov 50f610cfd8 [Test] Add forgotten dumps for Fir2Ir text tests 2021-12-06 19:23:14 +03:00
Mikhail Glukhikh 85240bdb06 FIR2IR: generate type arguments in delegation calls 2021-12-06 18:07:17 +03:00
Anastasiya Shadrina 4d3035e2f7 [Parser] Do not support local contextual declarations 2021-12-03 20:22:17 +03:00
Anastasiya Shadrina 2d088196ce [FE] Fill DESCRIPTOR_TO_CONTEXT_RECEIVER_MAP only with CR enabled 2021-12-02 20:25:06 +03:00
Anastasiya Shadrina a70036c945 [Tests] Add a test with type parameter as a context receiver 2021-12-02 20:24:58 +03:00
Anastasiya Shadrina 08570a37b8 [PSI2IR] Check how contextual functional type works with IR 2021-12-02 20:24:56 +03:00
Anastasiya Shadrina 4d0eb74d79 [Tests] Make sure desugaring works with context receivers 2021-12-02 20:24:52 +03:00
Anastasiya Shadrina 0bfea4fc52 [IR, Tests] Fix functionalType sample 2021-12-02 20:24:51 +03:00
Anastasiya Shadrina 17f24319d0 [IR, Tests] Add context receivers count to IR dump 2021-12-02 20:24:46 +03:00
Anastasiya Shadrina 2fbfee3e11 [PSI2IR] Fix parameter initialization for constructors with CR 2021-12-02 20:24:36 +03:00
Anastasiya Shadrina f05ca5be33 [PSI2IR] Additional receiver -> context receiver 2021-12-02 20:24:26 +03:00
Anastasiya Shadrina 3f50b675b1 [Tests] Add irText tests 2021-12-02 20:24:25 +03:00