Dmitry Petrov
b4dc3dc91b
Fix exhaustiveness check for when with subject variable
2018-06-20 14:06:34 +03:00
Dmitry Petrov
67247ee490
'val' in 'when' subject can't have modifiers (annotations are ok)
2018-06-20 14:06:34 +03:00
Dmitry Savvinov
148d03e365
Add some data flow analysis tests on when
2018-06-20 14:06:34 +03:00
Dmitry Petrov
ae929d0f08
Handle nested when with subject properly
...
Hack: callee expression for when with subject variable is the subject
variable declaration. This solves the problem that all sub-calls in the
expression are implicitly considered to have a single common lexical
scope (and 'when (val x = ...)' introduces a new lexical scope, which
contains 'x').
2018-06-20 14:06:34 +03:00
Dmitry Petrov
758548603e
Extra tests for when with val in subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
091b935c2d
Introduce separate callee expression for when with subject variable
...
'Subject.Error' is redundant.
'Subject.None' can be an object.
'Subject#dataFlowValue' can be a lateinit property.
TODO: fix
- parsing local extension properties in 'when' subject
- parsing destructuring declarations in 'when' subject
- non-completed calls in nested 'when' with subject variable
- non-completed calls for subject variable in 'in' pattern
2018-06-20 14:06:34 +03:00
Dmitry Petrov
5f0c9490bb
Add test for smart cast on a value bound to when subject variable
...
E.g.:
when (val y = x?.foo()) {
null -> ...
else -> ... // 'x' is also non-null here
}
2018-06-20 14:06:34 +03:00
Dmitry Petrov
0a0bc67e8a
Add test for UNUSED_VALUE on when subject variable
2018-06-20 14:06:34 +03:00
Dmitry Petrov
c20c1abb68
Add test for VAL_REASSIGNMENT on when subject variable
2018-06-20 14:06:34 +03:00
Dmitry Petrov
7bc89b8871
Report error on illegal variable declaration in when subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
098d3eb235
Make smart casts work with variable declared in when subject
2018-06-20 14:06:34 +03:00
Dmitry Petrov
1eeafc2d0e
Resolve variable declaration in 'when' subject
2018-06-20 14:06:34 +03:00
Dmitry Savvinov
33f9576dd1
[NI] Turn off KnownTypeParameterSubstitutor for NI
...
The main consequence of it is that TYPE_MISMATCH range for control
structures became wider.
Also, for extra safety, don't change behaviour of OI.
2017-12-07 14:05:42 +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
fitermay
e30b9758f4
Introduce action to add missing when branches on sealed class
...
Made via diagnostics NON_EXHAUSTIVE_WHEN_FOR_SEALED_CLASS
with INFO severity and quick-fix
So #KT-17580 Fixed
2017-05-16 16:43:27 +03:00
Dmitry Neverov
cd24adac32
Detect redundant 'is' check
...
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00
Mikhail Glukhikh
14886827a2
Introduce warning REDUNDANT_ELSE_IN_WHEN #KT-17497 Fixed
2017-05-04 14:17: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
mglukhikh
f64345634b
WHEN_ENUM_CAN_BE_NULL_IN_JAVA is no more reported after smart cast to not-null #KT-15201 Fixed
2017-01-24 13:51:15 +03:00
Mikhail Zarechenskiy
76b0b785c5
Prohibit to use enum entry as a type
...
#KT-14179 Fixed
2017-01-09 18:30:32 +03:00
Denis Zharkov
4c69416f2b
Report warning on unused entities that can be renamed to _
...
Currently it's all about lambda parameters/destructuring entries
#KT-14347 In Progress
2016-10-24 10:19:25 +03:00
Valentin Kipyatkov
ec51076355
DescriptorRenderer to render annotations for all types + separate option to render annotation arguments + use it in IdeDescriptorRenderers
2016-10-11 23:38:54 +03:00
Michael Bogdanov
3b419e8ba3
Fix for KT-11964: No TABLESWITCH in when on enum bytecode if enum constant is imported
...
#KT-11964 Fixed
2016-06-29 09:32:45 +03:00
Stanislav Erokhin
7332032bb6
Support sealed class inheritors in the same file
...
#KT-11573 Fixed
2016-05-19 16:22:40 +03:00
Denis Zharkov
d0acb3674a
Fix rendered testData
...
New members in enum member scope
2016-05-16 15:38:13 +03:00
Mikhail Glukhikh
771fb0ace2
Compiler warning on identical enum constant / is type entries #KT-4829 Fixed
2016-04-20 12:21:31 +03:00
Alexander Udalov
1b8f934b54
Delete deprecated enum 'values' property
2016-02-19 22:28:44 +03:00
Dmitry Petrov
c5fd496cc9
Fix KT-10805 for 'when'.
2016-01-27 17:07:20 +03:00
Dmitry Petrov
9db3440e72
Fix type inference issues for 'if' and 'when'.
...
Use 'expectedType' (when present) as an explicit type argument for a special construct call.
Unfortunately, this approach can't be used for elvis due to other elvis-related inference hacks.
Fixes KT-10807, KT-10811.
This also affects KT-6189: now we can infer proper type for 'if'.
If type inference for special call failed, and we found no type errors in sub-expressions,
report TYPE_INFERENCE_FAILED_ON_SPECIAL_CONSTRUCT error.
This (and the hack above) fixes KT-10809: code no longer compiles.
2016-01-27 17:07:20 +03:00
Dmitry Petrov
f371e67ce8
PatternMatchingTypingVisitor:
...
rewrite type inference for 'when' using special constructs.
This fixes several type inference issues for 'when':
KT-9929, KT-9972, KT-10439, KT-10463
along with some other diagnostics-related issues.
2016-01-22 10:41:55 +03:00
Mikhail Glukhikh
9360bd49a6
Data flow info: correct disjunction of a type with Nothing: Type U Nothing = Type #KT-9578 Fixed
2016-01-19 16:01:10 +03:00
Mikhail Glukhikh
011a9f23b9
Implicit exhaustive when check for definite variable initialization (KT-8700)
2015-12-26 10:46:35 +03:00
Mikhail Glukhikh
b93894953d
Exhaustive whens without else and 'Nothing' as the result are considered 'implicit exhaustive'
2015-12-26 10:46:11 +03:00
Mikhail Glukhikh
b805ce06c2
CFG exhaustive when else instruction for KT-8700
2015-12-26 10:46:01 +03:00
Andrey Breslav
75ab0dd509
'sealed' reserved in front of when
2015-12-18 21:20:54 +03:00
Mikhail Glukhikh
c8b50eec1e
Enum.values: deprecation (warning) --> deprecation (error)
2015-12-11 11:11:42 +03:00
Dmitry Petrov
76931affc6
KT-10139:
...
Non-exhaustive 'when' without 'else' used in expression is an error
regardless of expected type: it can't be an expression, even of type Unit.
2015-12-01 10:36:40 +03:00
Mikhail Glukhikh
89e56093a2
Limit "always null" scope: only for !!, is and dot; senseless comparison rolled back; "smart constant" information for nulls #KT-10029 Fixed
2015-11-25 18:26:08 +03:00
Dmitry Petrov
da90c21284
Warn about comma-separated conditions in when without argument.
...
See KT-5143.
2015-11-25 15:39:23 +03:00
Mikhail Glukhikh
dc60c62781
Enum.values is now deprecated but Enum.values() is no more deprecated
2015-11-23 17:29:36 +03:00
Mikhail Glukhikh
2d9fbf5696
Always null detection
2015-11-09 16:36:34 +03:00
Alexey Tsvetkov
dc27363452
Remove @annotation from test data
2015-10-19 20:45:01 +03:00
Denis Zharkov
1c02231cda
Regenerate rendered descriptors after transforming Enum.values to property
2015-10-17 17:46:16 +03:00
Mikhail Glukhikh
f8a356747e
Stdlib rename: 'name' and 'ordinal' are now properties in Enum, same name functions are deprecated
2015-10-14 20:40:13 +03:00
Denis Zharkov
f0e3fd617d
Adjust testData to CharSequence.length transformation
2015-10-14 20:39:35 +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
Alexander Udalov
9882e86ecb
Don't render contents of enum entry classes in .txt tests, regenerate tests
...
They are irrelevant because cannot be accessed from the outside anyway
2015-08-28 21:11:06 +03:00