Refactoring of JetTypeInfo / BindingContext. Loop data flow analysis corrected.

Now BindingContext includes expression type info instead of jump out possible, data flow info and expression type.
getType() was added into BindingContext, getType() and recordType() were added into BindingTrace.
JetTypeInfo now includes also jump possible flag and jump point data flow info.
Old TypeInfoWithJumpInfo deleted.
TypeInfoFactory introduced to create JetTypeInfo instances.
A pack of extra tests for break / continue in loops added.
This commit is contained in:
Mikhail Glukhikh
2015-04-20 16:12:49 +03:00
parent 14b92404cd
commit 27625b04e1
113 changed files with 908 additions and 550 deletions
@@ -216,7 +216,7 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker {
is JetPostfixExpression ->
if (expression.getOperationToken() == JetTokens.EXCLEXCL) {
val baseExpression = expression.getBaseExpression()
val baseExpressionType = c.trace.get(BindingContext.EXPRESSION_TYPE, baseExpression) ?: return
val baseExpressionType = c.trace.getType(baseExpression) ?: return
doIfNotNull(
DataFlowValueFactory.createDataFlowValue(baseExpression, baseExpressionType, c),
c
@@ -228,7 +228,7 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker {
when (expression.getOperationToken()) {
JetTokens.ELVIS -> {
val baseExpression = expression.getLeft()
val baseExpressionType = c.trace.get(BindingContext.EXPRESSION_TYPE, baseExpression) ?: return
val baseExpressionType = c.trace.getType(baseExpression) ?: return
doIfNotNull(
DataFlowValueFactory.createDataFlowValue(baseExpression, baseExpressionType, c),
c
@@ -243,7 +243,7 @@ public class JavaNullabilityWarningsChecker : AdditionalTypeChecker {
if (expression.getLeft() != null && expression.getRight() != null) {
SenselessComparisonChecker.checkSenselessComparisonWithNull(
expression, expression.getLeft()!!, expression.getRight()!!, c,
{ c.trace.get(BindingContext.EXPRESSION_TYPE, it) },
{ c.trace.getType(it) },
{
value ->
doIfNotNull(value, c) { Nullability.NOT_NULL } ?: Nullability.UNKNOWN