Bug #11038
Cannot find symbol when using two frames with the same name
0%
History
#1 Updated by Radu Apetrii 7 months ago
I stumbled upon this when working with a customer application. Here's a testcase:
def var a as int.
def frame f a view-as text.
def var h as handle.
assign h = a:handle.
procedure p:
def var a as int.
def frame f a view-as text.
def var h2 as handle.
assign h2 = a:handle.
end.
run p.
The error:
[javac] dataset/src/com/goldencode/dataset/Start.java:36: error: cannot find symbol
[javac] h.assign(fFrame.widgeta().asWidgetHandle());
[javac] ^
[javac] symbol: method widgeta()
[javac] location: variable fFrame of type StartF
[javac] 1 error
Notice how both frames have the same name. What I think is happening is that the first frame is generated, then, when dealing with the second one (the one from the procedure), the class itself is overwritten, and loses the information that will be used for the first frame. That's why the error appears when doing the outer assign h = a:handle.. As a matter of fact, here's the Java sources:
1. StartF.java:
Show
2. Start.java:
Show
First of all, I would be interested in knowing if there is already a task that handles this particular issue. Then, is it possible to have some sort of estimate as to how long it would take to develop a fix for this? I need to tell the customer if they should make a 4GL change until we get a solution for this problem, or just wait until we get it done. Also, if you have suggestions for who should work on this task, feel free to assign it.
#3 Updated by Radu Apetrii 7 months ago
Greg Shah wrote:
Notice how both frames have the same name
This is not correct. The issue is that there should only be one frame, even though multiple statements reference it.
Does this mean that we should append the methods and functions for the inner variables to the interface?
For example, currently, when the first def frame f is encountered, we generate functions such as widgeta(). Then, at the second define frame statement, those previous functions are overriden with, for example, widgetA_1(). If we were to have both sets of functions, I think we should be able to correctly identify which one goes where.
#5 Updated by Radu Apetrii 7 months ago
So, in this case, do we just need to have some form of discrimination between frames with the same name? Or at least that's what seems to happen with variables, e.g. widgeta() and widgetA_1() when both variables are named a.
#6 Updated by Greg Shah 7 months ago
Radu Apetrii wrote:
So, in this case, do we just need to have some form of discrimination between frames with the same name? Or at least that's what seems to happen with variables, e.g.
widgeta()andwidgetA_1()when both variables are nameda.
It isn't clear where the widgeta() comes from. We are using the same frame definition class for both frame instances, which seems OK but the lookup of the widget names is not right for the external proc. We need to debug into the frame_scoping.rules (and possibly into frame_generator.xml.