You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2022/01/12 15:38:32 UTC

[groovy] 01/02: source range for `void` return type

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit bc4f802929a8000ea4e1dba327199d9f5798f985
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed Jan 12 09:37:45 2022 -0600

    source range for `void` return type
---
 src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index f22539c..690547c 100644
--- a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -2192,11 +2192,11 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> {
         }
 
         if (asBoolean(ctx.VOID())) {
-            if (3 == ctx.ct) { // annotation
+            if (ctx.ct == 3) { // annotation
                 throw createParsingFailedException("annotation method cannot have void return type", ctx);
             }
 
-            return ClassHelper.VOID_TYPE.getPlainNodeReference(false);
+            return configureAST(ClassHelper.VOID_TYPE.getPlainNodeReference(false), ctx.VOID());
         }
 
         throw createParsingFailedException("Unsupported return type: " + ctx.getText(), ctx);