Commit Graph

190 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy
ca894a6a71 [NI] Don't complete nested call if there's no constraints at all 2019-03-25 12:17:28 +03:00
Dmitriy Novozhilov
9825984bc5 [NI] Update test data for diagnostic tests 2019-03-25 12:17:27 +03:00
victor.petukhov
70c35f4186 Introduce warning about implicitly inferred Nothing as a type parameter
^KT-20849 Fixed
2019-03-15 19:28:38 +03:00
victor.petukhov
46bd5ba107 Add alphabetical sorting diagnostics with same ranges 2019-02-14 12:31:42 +03:00
Mikhail Glukhikh
ad44118605 Delay UNUSED_PARAMETER on main parameter until 1.4 (part of KT-26999) 2018-10-31 19:00:29 +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
Dmitry Petrov
df6d4f358a KT-22274 report warning on labels that can't be referenced
Labels are meaningful only if they can be referenced by 'break',
'continue', or 'return' expressions.
2018-07-25 12:08:20 +03:00
Dmitry Savvinov
5cb949ad7f Fix language features in tests for gradual migration to 1.3 (part 2)
In 1.3, due to changes in language, testdata for some tests can be
different from 1.2

We want to simlultaneously test both versions, so instead of fixing
language version in such tests, we split them into two: one with fixed
1.2, another with fixed 1.3
2018-07-05 10:42:49 +03:00
Mikhail Zarechenskiy
9891f562cc [NI] Make subtyping algorithm more robust to error types
During subtyping/incorporation we transform types (e.g. changing nullability,
 form of the type) and, basically, we're doing this to some FIXPOINT.
 It's important that we use `KotlinType.hashCode()` to compare types, but
 for error types hashCode is a hashCode of its supertype and, for example,
 `makeNullableAsSpecified` method recreate type every time. So, we continue
 to generate new constraints and we'll never stop incorporation algorithm
2018-06-07 15:45:53 +03:00
Mikhail Zarechenskiy
612baacc25 Make useless elvis diagnostic more consistent for new and old inference
Also, remove diagnostics that can be covered by usual USELESS_ELVIS diagnostic
2018-04-12 14:38:55 +03:00
Mikhail Zarechenskiy
3afd4a2f4a [NI] Record all diagnostics from subcalls resolution results 2018-02-14 14:58:04 +03:00
Dmitry Savvinov
ea72c76a37 [NI] Testdata changes after fixes in error types 2017-12-07 12:49:56 +03:00
Mikhail Zarechenskiy
328c67b9e8 Add separate diagnostic renderer results for tests with NI 2017-11-29 02:54:30 +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
Denis Zharkov
1f9d56439a Fix KNPE caused by optimizations in control-flow analysis
The problem is that when performing full analysis we do it in
a backward order while result for trivial vals is filled
in a forward one.

It turns out that reversedInstuctions might return a superset of
forward traversed instructions, e.g. in case of dead code in lambda.

At the same time result for trivial vals is constant
for any instruction, thus we can just return its constant value
and use it in the full analysis

 #KT-20895 Fixed
2017-11-14 16:38:28 +03:00
Denis Zharkov
a51078fda6 Turn off optimizations in case of do-while presence 2017-10-02 10:04:16 +03:00
Denis Zharkov
c31b5beb9e Remove redundant check for a variable being initialized after write
It's anyway is obvious for write instruction, while effectively
after optimizations we treat val with syntactic initializer
uninitialized until their immediate initiazer
2017-10-02 10:04:16 +03:00
Denis Zharkov
527daced46 Optimize CFG for cases of simple variables
Parameters/vals with an immediate initializer (which we assume is a
rather common situation) do not require any kind of complicated CFA

- Unused vals can be simply determined by linear traversal of
  the pseudocode
- Definite assignment is a bit more complicated: a read-instruction of val
  can be considered as a safe if it's located *after* the first write in
  the pseudocode. It works almost always beside the case with do/while
  (see the test changed). This case will be fixed in the further commits

The test for kt897.kt will also be fixed further, all other changes
might be considered as minor as they mostly change diagnostics for
already red code
2017-10-02 10:04:16 +03:00
Dmitry Petrov
2b27e64fc8 Improve diagnostics for "not yet supported in inline"
- Tell user what exactly is not supported (e.g., local inline function)
- Reduce diagnostics range to a keyword or an identifier
  where appropriate

 #KT-16223 Fixed Target versions 1.1.50
2017-09-06 09:46:33 +03:00
Mikhail Zarechenskiy
2d3ce89afc Use only completed arguments of special call 2017-07-13 12:26:03 +03:00
Dmitry Neverov
cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Mikhail Zarechenskiy
7530a9426f Warn about val reassignment via backing field
#KT-16681 In Progress
2017-05-05 21:30:37 +03:00
Mikhail Glukhikh
14886827a2 Introduce warning REDUNDANT_ELSE_IN_WHEN #KT-17497 Fixed 2017-05-04 14:17:41 +03:00
Mikhail Glukhikh
b5d0de7c3f Add test for KT-17479 looks like #KT-17479 Fixed
(after CAPTURED_MEMBER_VAL_INITIALIZATION introduction)
2017-05-02 19:59:43 +03:00
Mikhail Glukhikh
28283bad3e Introduce special CAPTURED_VAL_INITIALIZATION for members 2017-05-02 19:59:37 +03:00
Mikhail Glukhikh
56e633e345 CFA: detect captured writes more precisely
So #KT-14381 Fixed
So #KT-13597 Fixed
Also refactors captured writes detection inside DFA
2017-05-02 19:59:23 +03:00
Mikhail Glukhikh
8fa739ed0f Test for KT-14381 and KT-13597 2017-05-02 19:02:01 +03:00
Mikhail Glukhikh
14e798a1fc Take imported from object descriptor into account in pseudocode
So #KT-15566 Fixed
2017-04-27 15:27:41 +03:00
Mikhail Glukhikh
7a53b2f4c8 Introduce UNUSED_ANONYMOUS_PARAMETER for anonymous functions
It is not reported for 1.0 language version because
renaming to _ is not possible. It has weak warning severity

So #KT-8813 Fixed
So #KT-16875 Fixed
2017-04-04 14:23:30 +03:00
Mikhail Glukhikh
b81268cca1 Control-flow analysis: do-while scope is ended after condition but before jump #KT-15334 Fixed 2017-01-10 17:57:43 +03:00
Mikhail Zarechenskiy
e67543e08e Revert "Update test data as operator 'mod' became deprecated"
This reverts commit 040f4e90ce.
2016-12-14 15:29:00 +03:00
Mikhail Zarechenskiy
040f4e90ce Update test data as operator 'mod' became deprecated
Revert this commit after changing 'mod' to 'rem' in stdlib
2016-12-09 16:59:25 +03:00
Mikhail Glukhikh
a19d178867 Initialization analysis : more accurate handling of non-local variables while merging data #KT-14304 Fixed 2016-10-20 19:52:44 +03:00
Valentin Kipyatkov
41ee06ec96 Use parameter names in DescriptorRenderer 2016-10-11 23:38:49 +03:00
Mikhail Glukhikh
436b0ec873 CFA merge for definition / initialization : more accurate handling of unknown variables #KT-13969 Fixed
(cherry picked from commit 4a96589)
2016-09-29 15:56:47 +03:00
Mikhail Glukhikh
025d063b27 UNNECESSARY_LATEINIT: do not report if property is not initialized at use-site #KT-13806 Fixed
(cherry picked from commit 09c0865)
2016-09-27 18:49:02 +03:00
Mikhail Glukhikh
4da9a101cf UNNECESSARY_LATEINIT warning introduced #KT-13295 Fixed
(cherry picked from commit 88f9938)
2016-09-27 18:48:50 +03:00
Alexander Udalov
090d157f86 Update test data for data classes 2016-09-15 16:45:48 +03:00
Mikhail Glukhikh
f8039249c6 CFA: additional jumps to catch / finally generated in the end of try / before exits from try #KT-5469 Fixed
Also #KT-13612 Fixed
(cherry picked from commit 7c188b3)
2016-08-31 19:28:09 +03:00
Mikhail Glukhikh
6a9d058db4 UNUSED_VALUE is now reported on expression only if this expression is unused in all (e.g. finally) branches #KT-9825 Fixed
(cherry picked from commit aac8e94)
2016-08-31 19:28:00 +03:00
Mikhail Glukhikh
25eefdb6ec Pseudocode label now cannot be bound to a non-owning pseudocode #KT-13555 Fixed
Also EA-77641 Fixed
(cherry picked from commit 07643ce)
2016-08-25 10:32:04 +03:00
Mikhail Glukhikh
d08d8af407 USELESS_ELVIS_RIGHT_IS_NULL : build fix (add to different files in DiagnosticsTestGenerated), do not report if USELESS_ELVIS already exists
(cherry picked from commit c71b656)
2016-08-23 16:26:54 +03:00
Mikhail Glukhikh
1c5c6506ce Report of UNINITIALIZED_ENUM_COMPANION also for implicit receivers #KT-11769 Fixed 2016-08-12 15:06:43 +03:00
Mikhail Glukhikh
04f71bccf2 KT-11769 case with companion function call: error is now detected if companion receiver is stated explicitly 2016-08-12 15:06:38 +03:00
Mikhail Glukhikh
30fd22499b Test data fix (after cherry-pick from 1.0.4) 2016-08-09 10:32:15 +03:00
Mikhail Glukhikh
b668206aa7 Minor: test comment, relevant to KT-13322
(cherry picked from commit 7606b1d)
2016-08-09 10:28:49 +03:00
Mikhail Glukhikh
13e64c18d9 Correct CFA order for enums: first own members, then entries, and at last companion object members #KT-6054 Fixed
(cherry picked from commit 94d3b4c)
2016-08-09 10:28:27 +03:00
Alexander Udalov
1bc7b4e363 Fix test data 2016-08-08 21:48:10 +03:00
Mikhail Glukhikh
0c98231f53 Report UNINITIALIZED_VARIABLE also for qualified object property #KT-12809 Fixed
(cherry picked from commit 7b2857f)
2016-08-08 17:48:08 +03:00