Skip to content

Commit

Permalink
Fix for #1337: void type for statements
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Jan 20, 2022
1 parent 2e5a51b commit 774c722
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1956,9 +1956,8 @@ private boolean handleStatement(final Statement node) {
}
}

// don't check the lookups because statements have no type;
// but individual requestors may choose to end the visit here
TypeLookupResult noLookup = new TypeLookupResult(declaring, declaring, declaring, TypeConfidence.EXACT, scope);
// do not check the lookups because statements have no type; however individual requestors may choose to end the visit here
TypeLookupResult noLookup = new TypeLookupResult(VariableScope.VOID_CLASS_NODE, declaring, null, TypeConfidence.EXACT, scope);
VisitStatus status = notifyRequestor(node, requestor, noLookup);
switch (status) {
case CONTINUE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2673,14 +2673,14 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite {
String contents = '''
|class C {
| @Deprecated def x
| def y() { x }
| def m() { x }
|}
|'''.stripMargin()

assertHighlighting(contents,
new HighlightedTypedPosition(contents.indexOf('C'), 1, CLASS),
new HighlightedTypedPosition(contents.indexOf('x'), 1, DEPRECATED),
new HighlightedTypedPosition(contents.lastIndexOf('y'), 1, METHOD),
new HighlightedTypedPosition(contents.indexOf('m'), 1, METHOD),
new HighlightedTypedPosition(contents.lastIndexOf('x'), 1, DEPRECATED))
}

Expand All @@ -2690,13 +2690,15 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite {
|@Deprecated
|class C {
| C x
| def m() { null }
|}
|'''.stripMargin()

assertHighlighting(contents,
new HighlightedTypedPosition(contents.indexOf('C'), 1, DEPRECATED),
new HighlightedTypedPosition(contents.lastIndexOf('C'), 1, DEPRECATED),
new HighlightedTypedPosition(contents.lastIndexOf('x'), 1, FIELD))
new HighlightedTypedPosition(contents.indexOf('C {'), 1, DEPRECATED),
new HighlightedTypedPosition(contents.indexOf('C x'), 1, DEPRECATED),
new HighlightedTypedPosition(contents.indexOf('x'), 1, FIELD),
new HighlightedTypedPosition(contents.indexOf('m'), 1, METHOD))
}

@Test
Expand Down

0 comments on commit 774c722

Please sign in to comment.