Ilya Kirillov
1bbcae5ed2
[FIR] fix resolve contract violation from scopes
...
We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier
^KT-54890
^KTIJ-23587 fixed
2023-01-13 21:32:51 +00:00
pyos
7ee1b75e43
FIR: don't add T <: Unit constraints that will only remove errors
...
^KT-55693 Fixed
2023-01-10 15:40:46 +02:00
pyos
5e8591d61d
FIR: use expected type for lambda return statements if possible
2023-01-10 15:40:46 +02: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
Ilya Kirillov
644d1bf0d0
[FIR] ignore tests which fail because of resolve contracts violation
2022-12-12 16:21:07 +00:00
Dmitriy Novozhilov
1b42298025
[FIR] Implement IMPLICIT_NOTHING_*_TYPE diagnostics
2022-11-22 15:46:19 +00:00
Pavel Mikhailovskii
fe5a6fd511
Disallow non-local break/continue in crossinline lambdas
2022-09-12 13:26:19 +00: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
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
Dmitriy Novozhilov
565c61a702
[FE 1.0] Fix false-negative INVALID_IF_AS_EXPRESSION_WARNING and NO_ELSE_IN_WHEN_WARNING
...
^KT-51711 Fixed
2022-03-28 12:37:24 +00:00
Victor Petukhov
27fa632630
[FE 1.0] Update test data with new error type representation
2022-03-23 21:13:33 +00:00
Jinseong Jeon
bb766a5235
RAW FIR: flatten if chains
2022-02-15 11:48:53 +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
Dmitriy Novozhilov
a2b8493f47
[FE 1.0] Prohibit using non exhaustive if and when in rhs of elvis expression
...
^KT-44705
^KT-49349 Fixed
2021-10-21 19:39:51 +03:00
Tianyu Geng
fadde98a86
FIR: fix label stealling and crash with multiple labels
...
Consider the code below
```
fun test() {
a@ b@ {
{}
}
}
```
Currently when the code is converted to FIR, label `b` is bound to the
outer lambda and `a` gets bound to the inner lambda because it's not
consumed. This is wrong and also leads transfromation to fail with
exceptions because of the unexpected consumption of `a`.
This change fixes the above issue by designating a specific node in the
AST as the allowed user of a label when the label is added.
2021-10-01 17:21:40 +03:00
Tianyu Geng
5c716ea979
FIR checker: report NOT_A_FUNCTION_LABEL
2021-10-01 17:21:39 +03:00
Ivan Kochurkin
84c5f58cab
[FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER
2021-08-25 21:53:23 +00:00
Andrey Zinovyev
1338675833
[FIR] Fix while's label, when condition has lambda
...
#KT-48116 Fixed
2021-08-12 10:20:45 +03:00
Ivan Kochurkin
2333b1bcf6
[FIR] Implement BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY
2021-07-26 21:13:23 +03:00
Andrey Zinovyev
a6984c5198
[FIR] Add NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY diagnostic
2021-07-19 13:40:28 +03:00
Tianyu Geng
31573a98e8
FIR checker: report EXPECTED_CONDITION
2021-07-06 18:27:23 +03:00
Tianyu Geng
6ec247b861
FIR: accept when(nothing) {} as exhaustive
...
FE1.0 accepts this but FIR current rejects it.
2021-06-24 18:26:17 +02:00
Mark Punzalan
af99ad0736
FIR checker: Report VAL_OR_VAR_ON_*_PARAMETER.
2021-05-25 20:39:34 +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
Denis.Zharkov
00821bbc63
FIR: Update test data (repeated diagnostics)
...
They are a bit redundant, but it needs additional work to be done
to avoid them
2021-05-20 17:24:33 +03:00
Denis.Zharkov
b94335dd1c
FIR: Update diagnostics test data
...
Green code correctly became red
2021-05-20 17:24:30 +03:00
Mikhail Glukhikh
3663884db2
FIR: support CONDITION_TYPE_MISMATCH diagnostic
...
We report CONDITION_TYPE_MISMATCH on
- loop conditions
- when branch conditions
- binary logic arguments
2021-05-20 12:22:20 +03:00
Jinseong Jeon
e2dc21da90
FIR checker: warn useless as and is
2021-05-05 18:20:51 +03:00
Jinseong Jeon
24d792fb49
FIR checker: warn useless elvis
2021-04-22 13:10:54 +03:00
Ivan Kochurkin
00bc04b3df
[FIR] Implement ELSE_MISPLACED_IN_WHEN diagnostics, fix tests
2021-04-19 15:46:38 +03:00
Mikhail Glukhikh
a736d62edd
FirForLoopChecker: report also OPERATOR_MODIFIER if appropriate + minor
...
This commits checks iterator/hasNext/next functions whether they are
declared as operator or not. Also, it changes logic of hasNext/next
error reporting, now we're able to report errors about both these
functions.
2021-04-19 15:11:10 +03:00
Mikhail Glukhikh
2e14b65644
Introduce FirForLoopChecker
2021-04-19 15:10:58 +03:00
Mikhail Glukhikh
6b95bcdbdb
FIR: support separate ASSIGNMENT_IN_EXPRESSION_CONTEXT
2021-04-19 15:10:18 +03:00
Mikhail Glukhikh
9894b97058
FIR: rename EXPRESSION_REQUIRED to EXPRESSION_EXPECTED
2021-04-19 15:09:50 +03:00
Ivan Kochurkin
4353365968
[FIR] Implement NULL_FOR_NONNULL_TYPE diagnostics, fix tests
2021-04-19 12:46:08 +03:00
vldf
57d2eb5da2
Introduce FirFunctionReturnTypeMismatchChecker
2021-04-13 21:36:33 +03:00
vldf
24f1f1221e
Introduce FirInitializerTypeMismatchChecker
2021-04-13 21:36:31 +03:00
Ivan Kochurkin
ad9b962536
[FIR] Fix tests (ARGUMENT_TYPE_MISMATCH instead of INCOMPATIBLE_CANDIDATE)
2021-04-12 23:49:55 +03:00
Jinseong Jeon
2ecb6733ed
FIR checker: warn unnecessary non-null assertions
2021-04-09 12:32:45 +03:00
Dmitriy Novozhilov
3cb17ac2f0
[FIR] Implement FirReturnAllowedChecker
...
Supported diagnostics:
- RETURN_NOT_ALLOWED
- RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
2021-04-06 12:30:41 +03:00
Tianyu Geng
761a0a7d0d
FIR checkers: report specific errors instead of INAPPLICABLE_CANDIDATE
...
Specifically, the report the following 4 errors.
* NON_VARARG_SPREAD
* ARGUMENT_PASSED_TWICE
* TOO_MANY_ARGUMENTS
* NO_VALUE_FOR_PARAMETER
Also added/updated the following position strategies.
* NAME_OF_NAMED_ARGUMENT
* VALUE_ARGUMENTS
2021-04-02 14:36:14 +03:00
Dmitriy Novozhilov
cd890d5833
[Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite
2021-03-29 16:12:29 +03:00
Dmitriy Novozhilov
8dd9d98129
[FIR] Implement checker for exhaustive when's in expression position
2021-02-09 16:04:40 +03:00
eugenpolytechnic
a564f92eef
FIR: introduce ThrowableSubclassChecker
2021-02-05 09:22:12 +03:00
eugenpolytechnic
5c0231b727
FIR: introduce CatchParameterChecker
2021-02-01 15:07:13 +03:00
Mikhail Glukhikh
7d4eaefd36
FIR: report UNSAFE_CALL on dot when possible
2021-01-29 16:55:26 +03:00