Skip to content

semantic: an unqualified field name resolves against a schema table but not against a temp-table buffer in scope #160

Description

@evanbrobertson

ABL lets a field be referenced without its table qualifier when a buffer for that table is in scope. oxabl supports this for schema tables and not for temp-tables, so an unqualified reference to a temp-table field is reported as an undefined symbol.

Repro

DEFINE TEMP-TABLE tt NO-UNDO FIELD f-date AS DATE.
DEFINE VARIABLE d AS DATE NO-UNDO.
FIND FIRST tt NO-LOCK NO-ERROR.
d = f-date.

error[LINT0001]: undefined symbol f-date``.

Three controls isolate it precisely:

Reference Result
d = tt.f-date. (qualified temp-table field) resolves
d = f-date. (unqualified temp-table field) false undefined-symbol
unqualified field of a schema table, buffer in scope resolves

So the unqualified-field fallback exists and works; it simply does not consider temp-table buffers.

Why it matters more than the repro suggests

The shape that surfaced this was a temp-table arriving as a parameter:

DEF INPUT-OUTPUT PARAM TABLE FOR t-misc.
...
ASSIGN receipts.rec-date = t-date.   /* t-date is a field of t-misc */

A procedure that takes a TABLE FOR parameter and then reads its fields unqualified is ordinary ABL, and unqualified field access is idiomatic throughout the language — it is the reason FOR EACH customer: DISPLAY name. works. Every such read is currently a false error, and there is no configuration a user can change to silence it.

Fix shape

The unqualified lookup should search temp-table buffers in scope alongside schema tables. Two details worth settling while in there: whether a buffer created by FOR EACH tt: (which declares a fresh block-scoped buffer symbol) is searched as well as one from a DEFINE/parameter, and what happens when a schema table and a temp-table in scope both carry the field — ABL has a precedence rule and oxabl should match it rather than pick the first hit.

Pre-existing and independent of cross-file resolution: identical output on builds from before and after PR #153. Surfaced during in-editor dogfood, alongside #159 in the same file — the two are unrelated causes that happened to appear together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions