Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type propagation error with nested classes and anonymous inner class #65

Open
cal101 opened this issue May 25, 2017 · 0 comments
Open

Comments

@cal101
Copy link
Collaborator

cal101 commented May 25, 2017

I need help on solving this.
The problem is that the symbol data of the getOuter() is resolved to "Object" and
I don't know how this should be solved.

TypeVisitorAdaper, public void visit(MethodCallExpr n, A arg)
is reponsible coordinating calculating the symbol data of that.
For the current case the "else"-branch of "if (MethodInspector.isGeneric(m)) {" would solve
the problem, but I fail to see a sufficient condition to add to the if.
I don't find a way to express that the return value is already completely defined.

The other way would be enhancing the "then" branch to come to the same result as methodSymbol.type already has. But I fail to see how (programmatically) and why (conceptually, type resolution rules) the type variable "T" should become bound to StringBuilder.
Currently the then branch gets the declared class as scope which also may be be source of the problem.
I think I understand the java type resolution rules here but lack some understanding how that transfers to
the scopes and scope stacking .

test case:
https://github.com/cal101/javalang-compiler/tree/stacked-generic-and-anonymous
cal101@ea97a34

cal101@abac510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant