Commit Graph

74 Commits

Author SHA1 Message Date
Andrey Zinovyev 1cd321a90f [FIR] Add INAPPLICABLE_OPERATOR_MODIFIER diagnostic 2021-08-18 16:03:01 +03:00
Tianyu Geng 64ebddcbc6 FIR checker: add convention check for ++ and +=, etc 2021-08-16 15:14:30 +03:00
Mark Punzalan d1531f9cdd FIR: Choose a resolved candidate for augmented assignment when both
assign and operator candidates are unsuccessful.
2021-06-03 20:18:04 +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
Andrey Zinovyev 419aa65381 [FIR] Fix more tests because of modifier usage in resolution 2021-05-20 13:46:34 +03:00
Andrey Zinovyev 07a8ae7e71 [FIR] Mark more calls origin as OPERATOR 2021-05-20 13:46:32 +03:00
Ivan Kochurkin e57108d4e8 [FIR] Implement ASSIGNMENT_TYPE_MISMATCH, RESULT_TYPE_MISMATCH diagnostics, fix tests 2021-05-17 22:33:16 +03:00
Mikhail Glukhikh 2e14b65644 Introduce FirForLoopChecker 2021-04-19 15:10:58 +03:00
Tianyu Geng 4d2e3a2379 FIR: Fix resolving += to ignore + if it doesn't return correct type
This is the FIR fix of the FE change tracked by
https://youtrack.jetbrains.com/issue/KT-45503

Consider the following code:

```
fun foo() {
  var l = mutableListOf("")
  l += ""
}
```

The above code used to be considered invalid due to ambiguous `+=`. But
after KT-45503, it's now considered valid code because `plus` is not
really a valid option for this code. This is because the return type
of `plus` for `List` is `List`, which does not match the type of
variable `l`.

As for now, FIR rejects the above code due to ambiguous `+=`. This
change fixes that by also consider the return type when resolving `+=`.
2021-04-15 10:34:05 +03:00
Ivan Kochurkin ad9b962536 [FIR] Fix tests (ARGUMENT_TYPE_MISMATCH instead of INCOMPATIBLE_CANDIDATE) 2021-04-12 23:49:55 +03:00
Mikhail Glukhikh f0ff9ad5a7 FIR: rename AMBIGUITY to OVERLOAD_RESOLUTION_AMBIGUITY to match FE 1.0 2021-04-02 16:22:01 +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
Mikhail Glukhikh bf2e83f64c Make same tests FIR_IDENTICAL 2021-03-30 18:06:06 +03:00
Victor Petukhov 5d78b0a962 Report resolution ambiguity on '+=' by taking into account full resolution result including post type checking for '+'
^KT-45503 Fixed
2021-03-30 12:12:56 +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
Tianyu Geng d6907222cd FIR: pass the qualified access source when reporting ErrorNamedReference
Currently if there is an error in a function call, FIR would report the
entire expression if this call is qualified, but *only* the name if it's
not qualified. For example, assume the following two calls are all
contains some errors.

```
a.foo(1,2,3)
^^^^^^^^^^^^
bar(1,2,3)
^^^
```

The entire call of `foo` is reported since it's qualified. But only the
reference `bar` is reported since it's not qualified. This limits the
usage of position strategies because the IDE does not allow position
strategies to go outside of the initially reported PSI element
(org.jetbrains.kotlin.idea.fir.highlighter.KotlinHighLevelDiagnosticHighlightingPass#addDiagnostic).

This change passes both the original error named reference and the
surrounding qualified access expression and defer the decision of which
to use to the reporting logic.

For unresolved reference and checks on `super` keyword, the position
strategy should not highlight the surrounding parentheses. Hence a new
position strategy `REFERENCED_NAME_BY_QUALIFIED` is added.

In addition, this change also has the following side effect

* some diagnostics are no longer reported when there is a syntax error
  since the higher level structure does not exist when there is a syntax
  error
2021-03-29 12:45:27 +03:00
Jinseong Jeon 9c2d06cf70 FIR: strengthen resolution success check for augmented array set call
This commit removes some false ambiguities &
fixes compilation of tree-generator module with FIR
2020-12-18 14:24:24 +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
Mark Punzalan a2a4d94834 [FIR] Capture array and indices for postfix/prefix increment/decrement
of array element (including overloaded indexed access operators, e.g.,
`a[b, c]++`).

This prevents double-evaluation of the array and indices expressions,
which may have side-effects.
2020-10-02 12:08:03 +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
Dmitriy Novozhilov 29849b1330 [FIR] Resolve rhs of += in dependent context 2020-07-08 12:13:31 +03:00
Mikhail Glukhikh b27152f903 Replace some FIR syntax errors with more proper diagnostics 2020-03-27 16:46:59 +03:00
Dmitriy Novozhilov 2b986194fb [FIR] Add desugaring of array assignments and resolve of it
#KT-37516 Fixed
2020-03-18 11:31:53 +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
Mikhail Glukhikh abfe566255 [FIR] Add object support as implicit invoke receiver 2020-02-14 17:38:31 +03:00
Dmitriy Novozhilov 5ceb68f19f [FIR-TEST] Update some testdata 2020-02-10 10:54:04 +03:00
Denis Zharkov 47ecaa5b06 FIR: Fix scope intersection types
Otherwise overload resolution ambiguity is reported in the test
2020-01-30 17:12:50 +03:00
Mikhail Glukhikh de50f8aef3 FIR resolve: add partial support of extension lambda calls
Here we introduce ONLY_IMPLICIT_RECEIVER tower level
to support extension lambda calls on local variables,
and soften extension receiver checks to make such extensions visible & applicable.
Also here we try to map arguments twice for functional types
2019-12-27 09:57:36 +03:00
Dmitriy Novozhilov 2536fa0cd5 [FIR-TEST] Add new testdata generated after changes in previous commit 2019-12-12 16:11:46 +03:00
Mikhail Zarechenskiy a83225218f [NI] Fix checks for infix/operator conventions 2019-09-20 17:56:06 +03:00
Dmitriy Novozhilov e46f552a8d [NI] Update testdata in diagnostic tests 2019-05-06 11:36:20 +03:00
Mikhail Glukhikh f3555daa60 Report UNUSED_PARAMETER on main parameter in 1.3+ #KT-26999 Fixed 2018-10-25 19:10:39 +03:00
Mikhail Zarechenskiy 8757298994 Add diagnostics to test data from NI 2017-11-29 02:54:26 +03:00
Mikhail Zarechenskiy a71238bf94 Place !WITH_NEW_INFERENCE directive to diagnostics test data 2017-11-29 02:53:49 +03:00
Mikhail Zarechenskiy 5f71f1bcad Add warnings at declaration and call sites of operator 'mod' 2016-12-09 16:59:24 +03:00
Alexander Udalov 090d157f86 Update test data for data classes 2016-09-15 16:45:48 +03:00
Stanislav Erokhin 85a951db52 Fixed exception AssertionError: Illegal resolved call to variable with invoke
#KT-13330 Fixed
#KT-13349 Fixed
2016-08-15 19:24:17 +03:00
Yan Zhulanow 9b1402d804 Fix "No error on increment or augmented assignment when 'get' is an operator but 'set' is not" #KT-11300 2016-04-19 19:24:38 +03:00
Dmitry Petrov 3ca4097bcc KT-11203: report errors on read-write operations for elements of collections with inconsistent get&set signatures 2016-03-02 14:28:06 +03:00
Alexey Tsvetkov 1973573a89 Remove @data from test data 2015-10-19 20:45:00 +03:00
Yan Zhulanow b2470a6aad Report warning on unary plus()/minus() 2015-10-19 11:51:54 +03:00
Yan Zhulanow 275f3f8954 'operator' checks 2015-10-14 01:29:10 +03:00
Yan Zhulanow 1b01e7a85a Fix tests ('infix') 2015-10-07 15:50:23 +03:00
Yan Zhulanow 6db9344659 Fix compiler tests 2015-09-25 19:20:20 +03:00
Denis Zharkov 4850fd10f0 Regenerate test data containing rendered descriptors
Introduced '@' after each annotation
2015-09-18 10:14:39 +03:00
Michael Nedzelsky bc5c9065d2 fix tests in org.jetbrains.kotlin.checkers 2015-09-08 02:04:32 +03:00
Ilya Gorbunov 39b27751df Drop deprecated char operations: correct test data. 2015-07-04 04:46:23 +03:00
Ilya Gorbunov 84ca26719d Deprecate meaningless or vague-defined operations with Char operands.
Change expected test output.
2015-05-27 00:58:35 +03:00
Dmitry Jemerov 4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00