Skip to content

Commit

Permalink
* org.eclipse.jdt.core.dom.Expression#resolveTypeBinding returns null
Browse files Browse the repository at this point in the history
for PatternInstanceofExpression

* Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=575070
  • Loading branch information
srikanth-sankaran committed Mar 5, 2024
1 parent 692667c commit 2aa9e63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ public void testPatternInstanceOfExpression001() throws JavaModelException {
checkSourceRange(expression, "o instanceof String s", contents);
assertEquals("Not an instanceof expression", ASTNode.PATTERN_INSTANCEOF_EXPRESSION, expression.getNodeType());
PatternInstanceofExpression instanceofExpression = (PatternInstanceofExpression) expression;
ITypeBinding typeBinding = instanceofExpression.resolveTypeBinding();
assertEquals("boolean", typeBinding.toString());
SingleVariableDeclaration var = instanceofExpression.getRightOperand();
checkSourceRange(var, "String s", contents);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ synchronized ITypeBinding resolveExpressionType(Expression expression) {
case ASTNode.TYPE_LITERAL :
case ASTNode.INFIX_EXPRESSION :
case ASTNode.INSTANCEOF_EXPRESSION :
case ASTNode.PATTERN_INSTANCEOF_EXPRESSION:
case ASTNode.LAMBDA_EXPRESSION:
case ASTNode.CREATION_REFERENCE:
case ASTNode.EXPRESSION_METHOD_REFERENCE:
Expand All @@ -764,6 +765,7 @@ synchronized ITypeBinding resolveExpressionType(Expression expression) {
return this.getTypeBinding(compilerExpression.resolvedType);
}
break;

case ASTNode.TEXT_BLOCK :
case ASTNode.STRING_LITERAL :
if (this.scope != null) {
Expand Down

0 comments on commit 2aa9e63

Please sign in to comment.