Commit Graph

25 Commits

Author SHA1 Message Date
Mikhail Glukhikh fc6403679a Rename !USE_EXPERIMENTAL test directive to !OPT_IN 2021-09-10 16:29:16 +03:00
Tianyu Geng 280c445783 FIR checker: check super reference
This change touches the following diagnostics to make them behave closer
to FE1.0

* SUPER_NOT_AVAILABLE
* SUPER_IS_NOT_AN_EXPRESSION
* INSTANCE_ACCESS_BEFORE_SUPER_CALL
* NOT_A_SUPERTYPE

Other than tweaking the diagnostics, this change also alters resolution
by consider marking `super` with mismatched type parameter as
errorenous. As a result, the following code no longer resolves.

```
class A: B() {
  fun test() {
    super<String>.length
    //            ^^^^^^ FIR currently resolves this to `String.length`.
    //                   With this change, `length` becomes unresolved
    //                   instead
  }
}
```

Also, now we report `UNRESOLVED_LABEL` on unresolved label on `super`
reference, though FE1.0 reports `UNRESOLVED_REFERENCE`.

All the errors above are reported as ConeDiagnostics and hence some
checkers are deleted.

In addition, it also suppresses more downstream (mostly unresolved)
errors if the receiver has errors. FE1.0 doesn't do it for all the cases
we have here. But it seems nicer to reduce these "redundant" unresolved
errors.
2021-08-10 19:36:43 +03:00
Tianyu Geng c7272f6986 FIR checker: SENSELESS_(COMPARISON|NULL_IN_WHEN)
Currently DFA does not set "definitely equal to null" for access to variables that got assigned `null`. For example, FIR should mark the following line as SENSELESS_COMPARISON due to `s = null` above.
 https://github.com/JetBrains/kotlin/blob/d1531f9cdd5852352c0133198706125dc63b6007/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt#L6

The problem is at https://github.com/JetBrains/kotlin/blob/7e9f27436a77de1c76e3705da7aa1fbe8938336b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt#L1104

For null assignment, ideally the type should be `Nothing?`. This is
addressed in a followup commit instead.
2021-08-06 22:57:16 +03:00
Dmitriy Novozhilov 7b5a5f5682 [FE 1.0] Report USELESS_IS_CHECK if is expression is always false
^KT-47684 Fixed
2021-07-13 10:35:01 +03:00
Ilya Kirillov febc4986d1 FIR IDE: mute spec testdata based test failing in FIR IDE 2021-06-04 13:16:18 +02:00
Jinseong Jeon e2dc21da90 FIR checker: warn useless as and is 2021-05-05 18:20:51 +03:00
Dmitriy Novozhilov 32c3f85679 [FIR] Add inline checker for bodies of inline functions
This checker doesn't support `@PublishedAPI` yet, so some BB tests for it
 were muted. #KT-46270
2021-04-27 18:39:09 +03:00
Andrey Zinovyev 67505a0071 [FIR] Add FINAL_UPPER_BOUND checker 2021-04-05 14:51:44 +03:00
Jinseong Jeon 20f9787c70 FIR checker: report errors in contract description 2021-02-11 17:02:18 +03:00
Nick c8f8908a01 [FIR] Add NO_THIS & INSTANCE_ACCESS_BEFORE_SUPER_CALL 2020-08-24 11:06:10 +03:00
Oleg Ivanov 4367d6631f [FIR] Add CallsInPlace contract analyzer 2020-08-11 16:17:01 +03:00
anastasiia.spaseeva 9d862aaa1d [Spec tests] Remove spec info from fir tests 2020-05-26 17:27:06 +03:00
Denis Zharkov 3bb6aa6f28 Mark as FIR_IDENTICAL passing spec tests 2020-04-21 10:16:42 +03:00
Denis Zharkov 86e1aadd31 FIR: Adjust testData for spec tests: contracts 2020-04-21 09:52:52 +03:00
Dmitriy Novozhilov d210df9ea3 Update spec testdata according to previous commits 2019-12-26 17:43:28 +03:00
victor.petukhov cf692fb257 Implement tests map generator and refactor folder structure to spec tests linking 2019-08-19 18:31:40 +03:00
victor.petukhov 86bb5d689d Add various tests for DFA testing 2019-04-19 11:55:30 +03:00
Dmitriy Novozhilov 84da8b6279 Report CONTRACT_NOT_ALLOWED diagnostic on extension property getter/setter
KT-27090
2019-03-01 14:50:46 +03:00
victor.petukhov ec8a6cbe9c Alphabetical sort wrapped intersection types for rendered diagnostics 2019-02-14 12:31:43 +03:00
victor.petukhov 64f531fc93 Reorganize spec tests infrastructure code
- Add the tests mute system for the diagnostic tests
- Move the code for the test info parsing to the separate package `parsers`
- Unification of the `linked` and `not linked` spec tests
- Package structure is refactored
- Change the multiline comment format with a test information
- Actualize `PrintSpecTestsStatistic`
- Other different code improvements
2018-11-23 17:23:41 +03:00
victor.petukhov 30fc76a602 Remove redundant directives to contracts use 2018-10-03 13:49:32 +03:00
victor.petukhov 8538866778 Add few tests for contracts
- Contracts in getter/setter (unexpected behaviour)
- Check smartcasts when non-null assertion for a contract function is used
- Check work of contracts when type parameter of the callsInPlace is specify explicitly
- Check smartcasts working if type checking for contract function is used
2018-10-03 13:29:13 +03:00
victor.petukhov ecb3f10e47 Add 'mute' concept: move tests with unexpected behaviour to the corresponding folder 2018-10-03 13:26:37 +03:00
victor.petukhov 84dc28374c Add multilevel sections support and corresponding renaming 2018-10-03 13:26:29 +03:00
victor.petukhov 8d91e5998d Add spec tests for contracts 2018-08-31 17:15:51 +03:00