Project

General

Profile

Bug #11038

Cannot find symbol when using two frames with the same name

Added by Radu Apetrii 7 months ago. Updated 7 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

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:

2. Start.java:

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.

#2 Updated by Greg Shah 7 months ago

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.

#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.

#4 Updated by Greg Shah 7 months ago

I mis-read the code. Multiple def frame instances do indeed create multiple frames, it is just that one of them is scoped to the procedure p in this case.

#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() and widgetA_1() when both variables are named a.

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.

Also available in: Atom PDF