Skip to content

Commit

Permalink
Fix for #421: Parrot Parser: primitive property
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Oct 13, 2022
1 parent a70bf43 commit 299cc84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2969,7 +2969,11 @@ private List<ConstructorNode> getDeclaredAndGeneratedConstructors(ClassNode clas
public void addConstructor(ConstructorNode ctor) {
// remove source offsets from param type
for (Parameter p : ctor.getParameters()) {
p.setType(p.getType().getPlainNodeReference());
ClassNode pt = p.getType().redirect();
if (!ClassHelper.isPrimitiveType(pt)){
pt = pt.getPlainNodeReference();
}
p.setType(pt);
}
ctor.setDeclaringClass(classNode);
generated.add(ctor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2342,8 +2342,9 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite {
@Test // https://github.com/groovy/groovy-eclipse/issues/959
void testAnnoElems7() {
String contents = '''\
|@groovy.transform.EqualsAndHashCode
|@groovy.transform.AnnotationCollector
|@groovy.transform.EqualsAndHashCode
|@groovy.transform.TupleConstructor
|@interface A {
|}
|@A(excludes = 'temporary')
Expand All @@ -2362,8 +2363,8 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite {
@Test // https://github.com/groovy/groovy-eclipse/issues/959
void testAnnoElems8() {
addGroovySource '''\
|@groovy.transform.EqualsAndHashCode
|@groovy.transform.AnnotationCollector
|@groovy.transform.EqualsAndHashCode
|@interface A {
|}
|'''.stripMargin(), 'A'
Expand Down Expand Up @@ -2465,6 +2466,7 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite {
| assert string?.size() > 1
|})
|class Pogo {
| double floats
| Number number
| String string
|}
Expand All @@ -2482,9 +2484,10 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite {
new HighlightedTypedPosition(contents.indexOf('1'), 1, NUMBER),
//
new HighlightedTypedPosition(contents.indexOf('Pogo'), 4, CLASS),
new HighlightedTypedPosition(contents.lastIndexOf('floats'), 6, FIELD),
new HighlightedTypedPosition(contents.indexOf('Number'), 6, ABSTRACT_CLASS),
new HighlightedTypedPosition(contents.indexOf('String'), 6, CLASS),
new HighlightedTypedPosition(contents.lastIndexOf('number'), 6, FIELD),
new HighlightedTypedPosition(contents.indexOf('String'), 6, CLASS),
new HighlightedTypedPosition(contents.lastIndexOf('string'), 6, FIELD))
}

Expand Down

0 comments on commit 299cc84

Please sign in to comment.