Added === and !== in addition to == and !=
This commit is contained in:
@@ -220,7 +220,7 @@ class PartialBodyResolveFilter(
|
|||||||
expression.acceptChildren(this)
|
expression.acceptChildren(this)
|
||||||
|
|
||||||
val operation = expression.getOperationToken()
|
val operation = expression.getOperationToken()
|
||||||
if (operation == JetTokens.EQEQ || operation == JetTokens.EXCLEQ) {
|
if (operation == JetTokens.EQEQ || operation == JetTokens.EXCLEQ || operation == JetTokens.EQEQEQ || operation == JetTokens.EXCLEQEQEQ) {
|
||||||
result.addIfNotNull(expression.getLeft()?.smartCastExpressionName())
|
result.addIfNotNull(expression.getLeft()?.smartCastExpressionName())
|
||||||
result.addIfNotNull(expression.getRight()?.smartCastExpressionName())
|
result.addIfNotNull(expression.getRight()?.smartCastExpressionName())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,7 +212,8 @@ class ExpectedInfos(val bindingContext: BindingContext, val resolutionFacade: Re
|
|||||||
val binaryExpression = expressionWithType.getParent() as? JetBinaryExpression
|
val binaryExpression = expressionWithType.getParent() as? JetBinaryExpression
|
||||||
if (binaryExpression != null) {
|
if (binaryExpression != null) {
|
||||||
val operationToken = binaryExpression.getOperationToken()
|
val operationToken = binaryExpression.getOperationToken()
|
||||||
if (operationToken == JetTokens.EQ || operationToken == JetTokens.EQEQ || operationToken == JetTokens.EXCLEQ) {
|
if (operationToken == JetTokens.EQ || operationToken == JetTokens.EQEQ || operationToken == JetTokens.EXCLEQ
|
||||||
|
|| operationToken == JetTokens.EQEQEQ || operationToken == JetTokens.EXCLEQEQEQ) {
|
||||||
val otherOperand = if (expressionWithType == binaryExpression.getRight()) binaryExpression.getLeft() else binaryExpression.getRight()
|
val otherOperand = if (expressionWithType == binaryExpression.getRight()) binaryExpression.getLeft() else binaryExpression.getRight()
|
||||||
if (otherOperand != null) {
|
if (otherOperand != null) {
|
||||||
val expressionType = bindingContext[BindingContext.EXPRESSION_TYPE, otherOperand] ?: return null
|
val expressionType = bindingContext[BindingContext.EXPRESSION_TYPE, otherOperand] ?: return null
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression,
|
|||||||
if (filteredExpectedInfos.isEmpty()) return null
|
if (filteredExpectedInfos.isEmpty()) return null
|
||||||
|
|
||||||
// if we complete argument of == or !=, make types in expected info's nullable to allow nullable items too
|
// if we complete argument of == or !=, make types in expected info's nullable to allow nullable items too
|
||||||
val expectedInfos = if ((expressionWithType.getParent() as? JetBinaryExpression)?.getOperationToken() in setOf(JetTokens.EQEQ, JetTokens.EXCLEQ))
|
val expectedInfos = if ((expressionWithType.getParent() as? JetBinaryExpression)?.getOperationToken() in COMPARISON_TOKENS)
|
||||||
filteredExpectedInfos.map { ExpectedInfo(it.type.makeNullable(), it.name, it.tail) }
|
filteredExpectedInfos.map { ExpectedInfo(it.type.makeNullable(), it.name, it.tail) }
|
||||||
else
|
else
|
||||||
filteredExpectedInfos
|
filteredExpectedInfos
|
||||||
@@ -182,7 +182,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression,
|
|||||||
is JetBinaryExpression -> {
|
is JetBinaryExpression -> {
|
||||||
if (parent.getRight() == expression) {
|
if (parent.getRight() == expression) {
|
||||||
val operationToken = parent.getOperationToken()
|
val operationToken = parent.getOperationToken()
|
||||||
if (operationToken == JetTokens.EQ || operationToken == JetTokens.EQEQ || operationToken == JetTokens.EXCLEQ) {
|
if (operationToken == JetTokens.EQ || operationToken in COMPARISON_TOKENS) {
|
||||||
val left = parent.getLeft()
|
val left = parent.getLeft()
|
||||||
if (left is JetReferenceExpression) {
|
if (left is JetReferenceExpression) {
|
||||||
return bindingContext[BindingContext.REFERENCE_TARGET, left].toSet()
|
return bindingContext[BindingContext.REFERENCE_TARGET, left].toSet()
|
||||||
@@ -326,5 +326,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression,
|
|||||||
class object {
|
class object {
|
||||||
public val OLD_ARGUMENTS_REPLACEMENT_OFFSET: OffsetKey = OffsetKey.create("nonFunctionReplacementOffset")
|
public val OLD_ARGUMENTS_REPLACEMENT_OFFSET: OffsetKey = OffsetKey.create("nonFunctionReplacementOffset")
|
||||||
public val MULTIPLE_ARGUMENTS_REPLACEMENT_OFFSET: OffsetKey = OffsetKey.create("multipleArgumentsReplacementOffset")
|
public val MULTIPLE_ARGUMENTS_REPLACEMENT_OFFSET: OffsetKey = OffsetKey.create("multipleArgumentsReplacementOffset")
|
||||||
|
|
||||||
|
private val COMPARISON_TOKENS = setOf(JetTokens.EQEQ, JetTokens.EXCLEQ, JetTokens.EQEQEQ, JetTokens.EXCLEQEQEQ)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user