Commit Graph

175 Commits

Author SHA1 Message Date
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
Jinseong Jeon e72ddbcbfe FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors,
we will record expected/actual type of receiver, if any.
That will help identifying inapplicable calls on nullable receiver.
2021-01-29 16:54:23 +03:00
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00
Dmitriy Novozhilov f283f2db43 [FIR] Improve diagnostic reporting & don't use error symbol for candidate if possible
Also introduce few new diagnostics:
- NONE_APPLICABLE more many inapplicable candidates
- HIDDEN for visible candidates
2020-07-28 20:46:56 +03:00
Mikhail Zarechenskiy 100a6f70ca Relax rules about inferring to Nothing for special calls
#KT-37388 Fixed
 #KT-38427 Fixed
 #KT-39953 Fixed
 #KT-38899 Fixed
2020-07-16 09:56:46 +03:00
simon.ogorodnik f573719cc1 [FIR] Fix missing receiver type if anonymous function without label 2020-04-08 14:56:17 +03:00
Mikhail Glukhikh b27152f903 Replace some FIR syntax errors with more proper diagnostics 2020-03-27 16:46:59 +03:00
Denis Zharkov cdd7e41891 FIR: Support proper implicit return type computation for local classes 2020-03-25 14:53:34 +03:00
Mikhail Glukhikh 8884cbe415 Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed 2020-03-05 09:39:40 +03:00
Ilya Chernikov 6356807997 Reapply "Only create descriptors for candidates with lambda args"
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
2020-02-14 11:41:30 +01:00
Dmitriy Novozhilov 5ceb68f19f [FIR-TEST] Update some testdata 2020-02-10 10:54:04 +03:00
Mikhail Glukhikh 64c7ab1302 [FIR] Fix lambda resolve in independent context 2020-02-04 15:00:12 +03:00
Dmitriy Novozhilov 5cb7cf040a Update some testdata according switching compiler to 1.4 2020-01-20 16:41:46 +03:00
Mikhail Glukhikh 5c6341b4e4 [FIR] Handle fully qualified expressions separately in tower resolver 2020-01-13 13:26:13 +03:00