Commit Graph

37 Commits

Author SHA1 Message Date
Alexander Udalov 6e410cb182 Make TypeConstructor.isFinal return false for enums
The reason is that before dc02b2e3ab and 8a0dcca957,
TypeConstructor.isFinal for some class descriptors
(DeserializedClassDescriptor, LazyJavaClassDescriptor,
MutableClassDescriptor) were implemented as `isFinalClass` (which is
`modality == FINAL && kind != ENUM_CLASS`), and all others as
`modality == FINAL` or simply true/false. This led to differences in
behavior depending on the exact instance of the class descriptor.
Now that TypeConstructor.isFinal is always `modality == FINAL`, some
tests (PseudoValueTestGenerated) fail because the finality of some type
constructors changed and these tests render final vs non-final type
constructors differently.

In this commit, TypeConstructor.isFinal is now made to behave safer,
i.e. considering enum class type constructor to be non-final (as was the
case earlier for some ClassDescriptor instances). Some diagnostics might
disappear (e.g. FINAL_UPPER_BOUND) but it doesn't look like a big deal
2017-10-18 12:45:45 +02:00
Denis Zharkov edbf360852 Do not render trivial variables in DataFlow tests
The reason is that while there are optimizations for them
definition of their state is both rather simple and may be
confusing in testData
2017-10-02 10:04:16 +03:00
Denis Zharkov 477aeef90c Update test data for rendered CFA results after optimizations 2017-10-02 10:04:16 +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 8baa9ba1de No parameter names in type of lambda expression and anonymous function 2016-10-11 23:38:54 +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 35446037bb UNINITIALIZED_ENUM_ENTRY compiler warning introduced #KT-2349 Fixed
(cherry picked from commit 76ac6d1)
2016-08-08 17:47:56 +03:00
Mikhail Glukhikh b805ce06c2 CFG exhaustive when else instruction for KT-8700 2015-12-26 10:46:01 +03:00
Mikhail Glukhikh fe13f39de9 Use of uninitialized variables in lambdas / object literals / local functions is forbidden now #KT-4475 Fixed
Local declarations CFA: variable initialization information before them is now taken into account
2015-11-17 18:21:09 +03:00
Denis Zharkov 73799e2c3c Replace deprecated lambda syntax in testData
It's done with similar constructions where possible trying to preserve
intended behavior.
Some usages are removed because they test exactly the feature that
we are going to drop soon.
2015-09-25 08:29:25 +03:00
Mikhail Glukhikh 285d5d06c7 More precise value reassignment analysis. #KT-7418 Fixed. #KT-6902 Fixed.
Variable can now be "exactly initialized", "may be initialized" and "not initialized".
A set of relevant tests. Some fixed tests.
2015-09-02 12:07:18 +03:00
Dmitry Jemerov 4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Dmitry Jemerov f93eeeb563 fix tests by adding missing 'init' keywords to testdata 2015-04-29 14:07:05 +02:00
Denis Zharkov 7d963e8e07 Differ this/non-this instances for vars initialization in class
When deal with constructed object (not this) treat it like it's fully initialized.

Otherwise (this or access with no receiver) access instruction
should be handled as it was before.

 #KT-6788 Fixed
 #KT-4126 Fixed
2015-03-11 17:45:25 +03:00
Svetlana Isakova 7a5124215a Updated test data for Array<out T> vararg type 2014-12-12 23:08:28 +03:00
Svetlana Isakova 976d5ab030 Pseudocode: don't write full label name when jump on it 2014-09-07 01:04:00 +04:00
Svetlana Isakova 3d7c22f242 Added exact label names for labels 2014-09-05 18:31:53 +04:00
Alexey Sedunov 77bbf8f73b Pseudocode: Generate fake values for Unit/Nothing-typed expressions 2014-07-28 13:07:29 +04:00
Alexey Sedunov 487e7f2a91 Pseudocode: Replace {<: Any?} type predicate with * 2014-07-11 19:13:52 +04:00
Alexey Sedunov 4707f4a5e9 Pseudocode: Add debug information to magic instructions 2014-07-11 19:13:49 +04:00
Alexey Sedunov 0a8fa404bf Pseudocode: Generate additional returns for implicit return values (lambdas, functions with expression bodies) 2014-07-11 19:13:26 +04:00
Svetlana Isakova aa26db0538 Updated tests for control flow: call instruction stores call element
instead of callee expression
2014-07-08 14:57:38 +04:00
Alexey Sedunov f226d99d36 Pseudocode: Add valued instructions and unbound values to AbstractPseudoValueTest 2014-06-26 13:06:23 +04:00
Alexey Sedunov 5e2c2b4eca Pseudocode: Implement computation of expected type predicates 2014-06-23 19:32:25 +04:00
Svetlana Isakova 9480907514 Mark some expressions after processing their components
when it's semantically correct

Expressions: calls, 'for' loops, elvis operators
It's significant for reporting 'unreachable code' correctly
2014-06-21 12:26:32 +04:00
Alexey Sedunov 45bd3a520e Pseudocode: Generate pseudo-values for implicit receivers 2014-06-19 22:04:45 +04:00
Alexey Sedunov 168b32920b Pseudocode: Do not bind call value to callee expressions 2014-06-19 22:04:44 +04:00
Alexey Sedunov 4a5d2e6728 Add tests for element -> pseudo-value mapping 2014-06-03 18:17:07 +04:00
Alexey Sedunov d2c055e9da Pseudocode: Introduce pseudo-value analysis 2014-06-03 18:17:05 +04:00
Svetlana Isakova fbbfb95861 added 'mergeDataWithLocalDeclarations' option
for collecting variable data for pseudocode

  removed using data from outer context
  for local declarations for 'variable initializers' analysis
2014-03-07 21:08:18 +04:00
Svetlana Isakova 7d46ff951e Jump after 'for' cycle to loop parameter change.
Not to the cycle body.
2014-03-07 21:08:17 +04:00
Svetlana Isakova e34385bbcf added tests to DataFlowTest
to be able to compare difference in the next commit
2014-03-07 21:08:17 +04:00
Svetlana Isakova 35c6a656c9 Store only data for variables declared in current lexical scope.
Remove data for other variables (when leaving a scope).
2014-03-07 21:08:17 +04:00
Svetlana Isakova 006f3ccbe9 Added/updated tests for LexicalScope. 2014-03-07 21:08:16 +04:00
Svetlana Isakova 6857694d1a added 'getParent' to Pseudocode
fixed DataFlowInfoTest:
variable data shouldn't be built for locals as independent declarations
2014-03-07 21:08:16 +04:00
Svetlana Isakova 88f2c32724 added DataFlowInfoTest 2014-03-07 21:08:16 +04:00