Commit Graph

212 Commits

Author SHA1 Message Date
Denis.Zharkov 6052e24626 K2: Adjust test data after PCLA implementation [red-to-red]
^KT-59791 In Progress
2024-01-10 14:56:30 +00:00
Ivan Kochurkin a2cd2200d6 [FIR] Infer Unit type for generic lambda function if implicit return exists
Make behavior more consistent with K1

^KT-63563 Fixed
2023-12-20 13:50:05 +00:00
Evgeniy.Zhelenskiy 20f74c22d7 [FIR] Support redeclaration diagnostics for different levels of destructured parameters
#KT-59875 #KT-59898
2023-12-15 21:00:01 +00:00
Alejandro Serrano Mena b1551c67e0 KT-59504 [FIR] Check _ on destructuring declarations
Previously the checker was ignoring them, leading to missing diagnostics

^KT-59504 Fixed
2023-09-22 21:46:09 +00:00
Ivan Kochurkin b5acd1da6a [FIR] Fix local RETURN_TYPE_MISMATCH with flexible Unit and multiple Unit returns 2023-09-21 12:52:32 +00:00
Ivan Kochurkin 4b9e15dfa8 [FIR] Fix missing RETURN_TYPE_MISMATCH for labeled return statements
in lambda functions, ^KT-59907 Fixed

(cherry picked from commit 8e72f60996)
2023-09-21 12:52:31 +00:00
Ivan Kochurkin 063835488f Revert "[FIR] Fix missing RETURN_TYPE_MISMATCH for labeled return statements"
This reverts commit 8e72f60996

Since some intellij tests are failing
2023-09-20 12:29:41 +02:00
Ivan Kochurkin 8e72f60996 [FIR] Fix missing RETURN_TYPE_MISMATCH for labeled return statements
in lambda functions, ^KT-59907 Fixed
2023-09-20 09:06:37 +00:00
Kirill Rakhman 80200fc3c5 [FIR] Replace type variable types with error types in lambda completion
#KT-54568 Fixed
#KT-59882
2023-08-15 08:04:19 +00:00
Nikolay Lunyak 71cc634a7c [FIR] Prevent missing diagnostics on free lambdas
The change in `FirPsiDiagnosticTestGenerated.Resolve#testCast`
only highlights the existing
problem that we don't assign a
valid type to `_`.

^KT-58906 Fixed
2023-08-08 11:00:04 +00:00
Ivan Kochurkin 8f5294a508 [FIR] Consider explicit returns during computing return type of anonymous function
Introduce FirAnonymousFunctionReturnExpressionInfo

^KT-59386
2023-07-20 09:36:55 +00:00
Kirill Rakhman 5abab2197b [FIR] Adapt positioning of NO_VALUE_FOR_PARAMETER to match K1 2023-07-04 16:00:45 +00:00
Denis.Zharkov c3ac2e44a0 Adjust test data for enabling ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-55388 Fixed
2023-05-15 10:43:19 +00:00
Dmitriy Novozhilov 82653855ab [FIR] Report missing ASSIGNMENT_TYPE_MISMATCH on functional types
^KT-45989
2023-04-30 16:12:54 +00:00
Ivan Kochurkin e49bb1fe37 [FIR] Support of REDECLARATION for local val/var, ^KT-54405 Fixed 2023-03-21 20:24:57 +00:00
Denis.Zharkov 33dcbaac16 K2: Change resolution rules of when/if expressions with expected type
When expected type is known, use it as expected type for branch bodies.
While it indeed becomes different from the usual select call resolution,
where expected type is applied only after completion starts,
it helps to support, e.g. callable references resolution just as powerful
as it was in K1.

Also, in some cases where diagnostics have been changed, they become
a bit more helpful since they are reported closer
to the problematic places

cannotCastToFunction.kt test has been removed because it relied
on the case erroneously supported by the hack removed from
the FirCallResolver in this commit.

^KT-45989 Fixed
^KT-55936 Fixed
^KT-56445 Fixed
^KT-54709 Related
^KT-55931 Related
2023-02-15 08:13:46 +00:00
Dmitriy Novozhilov f479a56f5e [FIR] Fix reporting of CANNOT_INFER_PARAMETER_TYPE on lambda parameters
^KT-56138 Fixed
2023-02-06 08:09:57 +00:00
Dmitriy Novozhilov e9204521a9 [FIR] Properly create type ref for error type in various places 2023-02-06 08:09:56 +00:00
pyos 1eccb9aea1 FIR: assume a lambda returns Unit if it ends with a non-expression
While it is theoretically useful to know that `{ while(true) {} }`
returns Nothing, CFG node deadness is not precise enough to do that: if
the entire lambda is dead, it's no longer possible to find out whether
the loop is terminating. Besides, `while (true)` and `if (true)` are
pretty much the only constructs like that anyway.

Note that this commit does not affect resolution for lambdas that end in
a Nothing-returning expression, e.g. `throw`.
2023-01-10 15:40:46 +02:00
Denis.Zharkov cd0d6d2773 Adjust test data for postponing ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated
^KT-55357 Related
^KT-36770 Related
2022-12-12 11:39:04 +00:00
Dmitriy Novozhilov 991d8c18aa [FIR] Fix incorrect inference of return type of anonymous functions
Also remove incorrect subtype check checkers

Test unsafeVarianceInAliasedFunctionalType.kt started to fail because
  of KT-54894. This bug existed before, changes from this commit just
  unhided it (previously it was hidden because incorrect subtype check
  in `isSubtypeForTypeMismatch` which is used by FirFunctionReturnTypeMismatchChecker
2022-11-22 15:46:19 +00:00
Dmitriy Novozhilov e6ce008415 [FIR] Ignore leaked internal types because of KT-54568 2022-11-03 08:30:09 +00:00
Nikolay Lunyak fcd3e4f4c5 [FIR JS] KT-51740: Alter positioning of NO_VALUE_FOR_PARAMETER 2022-09-30 21:39:20 +03:00
Victor Petukhov 42e71f8c53 Remove explicit enabling the new type inference from test data 2022-07-22 16:03:52 +00:00
Ilya Chernikov bb996c1b27 Switch kotlin version to 1.8
with appropriate fixes in testdata, tests and other
places.
2022-06-29 10:20:30 +02:00
Victor Petukhov 88d35067e3 [FE 1.0] Keep the same type attributes during union or intersection type attributes
^KT-51317 Fixed
2022-05-23 12:36:12 +02:00
Ivan Kochurkin 81b1ed9ad4 [FIR] Fix false positive RETURN_TYPE_MISMATCH in intellij ultimate 2022-04-07 21:03:08 +03:00
Ivan Kochurkin c6f52893fb [FIR] Fix inconsistent RETURN_TYPE_MISMATCH and TYPE_MISMATCH reporting on functions and properties
^KT-51203 Fixed
2022-04-05 15:50:43 +00:00
Victor Petukhov 27fa632630 [FE 1.0] Update test data with new error type representation 2022-03-23 21:13:33 +00:00
Mikhail Glukhikh 53d6ac24e5 Switch kotlin version to 1.7
* Change 1.6 to 1.7 constants
* Fix SAFE_CALL_WILL_CHANGE_NULLABILITY for testData
* Change EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_WARNING to EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR
* Change NON_EXHAUSTIVE_WHEN_STATEMENT to NO_ELSE_IN_WHEN
* Fix testData for SafeCallsAreAlwaysNullable
* Change T -> T & Any in test dumps
* Change INVALID_CHARACTERS_NATIVE_WARNING -> INVALID_CHARACTERS_NATIVE_ERROR
* TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING -> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR
2022-02-25 11:46:27 +00:00
Ivan Kylchik 6fc56477bf Drop all tests that disable features for language version less than 3 2021-12-28 20:08:56 +03:00
Mikhail Glukhikh b0ec3cb831 Switch off FIR version off REDUNDANT_LABEL_WARNING (performance-related)
This reverts commit 363b2550 (partially)
2021-10-27 12:26:59 +03:00
Tianyu Geng 363b25504d FIR checker: report REDUNDANT_LABEL_WARNING
Since many labels are not present in the FIR tree, this checker is
implemented as a syntax checker. Comparing with FE1.0, this change
reports some REDUNDANT_LABEL_WARNING that FE1.0 has missed, especially
LHS of assignments.
2021-10-25 13:51:01 +03:00
Mikhail Glukhikh 29e4c299e7 FIR: add & use hasExplicitParameterList to anonymous functions
#KT-49134 Fixed
2021-10-19 11:58:23 +03:00
Denis.Zharkov 4a9d4ed9fe Enable ProhibitUsingNullableTypeParameterAgainstNotNullAnnotated since 1.7
^KT-36770 Fixed
2021-08-31 15:41:17 +03:00
Denis.Zharkov 62bef48f9d Adjust test data to changed rendering: T!! -> T & Any
^KT-26245 In Progress
2021-08-31 15:41:15 +03:00
Ivan Kochurkin 84c5f58cab [FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER 2021-08-25 21:53:23 +00:00
Ivan Kochurkin cd6384eb20 [FIR] Fix handling of WRONG_MODIFIER_TARGET
Implement DEPRECATED_MODIFIER, DEPRECATED_MODIFIER_FOR_TARGET, REDUNDANT_MODIFIER_FOR_TARGET
2021-08-13 18:32:27 +03:00
Ivan Kochurkin 9736cc162b [FIR] Throw REDECLARATION for duplicated value parameters in function
Add new test file
2021-08-10 15:09:26 +00:00
Victor Petukhov cd09c8ba51 Report CANNOT_INFER_PARAMETER_TYPE on any error value parameters of a lambda
^KT-48058 Fixed
2021-08-06 13:27:57 +03:00
Ivan Kochurkin 1a40164ef0 [FIR] Fix resolving of single underscore _
Now compiler throws `UNRESOLVED_REFERENCE` here:

```
val boo = { _: Exception -> `_`.stackTrace }
```
2021-07-30 16:58:07 +00:00
Mikhael Bogdanov cc5ba4c0af Update diagnostic tests 2021-07-29 19:45:54 +02:00
Andrey Zinovyev a6984c5198 [FIR] Add NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY diagnostic 2021-07-19 13:40:28 +03:00
Ivan Kochurkin 9f7a8c3948 [FIR] Implement ILLEGAL_SELECTOR 2021-06-29 22:39:23 +03:00
Denis.Zharkov 0aca3a3737 FIR: Adjust test data after introduction of INFERENCE_NO_INFORMATION_FOR_PARAMETER
See previous commits for details
2021-06-07 15:25:47 +03:00
Victor Petukhov 54b9f39b3a Update tests after rebase 2021-05-28 15:36:24 +03:00
Victor Petukhov 4a767c597e Don't report the same diagnsotics several times 2021-05-28 15:36:23 +03:00
Denis.Zharkov dac9d7b17a FIR: Mark a pack of tests (53) as FIR_IDENTICAL 2021-05-25 13:28:29 +03:00
Denis.Zharkov ddbdfafa79 Remove OI/NI attributes from test data 2021-05-25 13:28:27 +03:00
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00