antlr / antlr/stringtemplate4

Interpreter.getAttribute scans attributes of parent scopes but ignores dictionaries

Open
#286 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

I found an unexpected behavior on resolving dictionaries and tracked it down to attribute resolution.

I found this code:
```
// got to root scope and no definition, try dictionaries in group and up
final ST self = scope.st;
STGroup g = self.impl.nativeGroup;
Object o = getDictionary(g, name);
if ( o!=null ) return o;

// not found, report unknown attr
throw new STNoSuchAttributeException(name, scope);
```

According to the comment ("try dictionaries in group and up") dictionaries of parent scopes should have been resolved, but the code does not.

Now what is wrong? The comment or the code?

Actually I cannot reduce my code to a reproducing example, but I can try to provide a new example if the code is considered wrong.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.