Warn when an unqualified reference resolves to a less specific property of the current namespace while a more specific one exists in another visible namespace

Open
#1,934 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
backend

Research direction

Start by tracing module-load name resolution and the existing ambiguous-name error path; the issue does not name source files or tests. Compare the namespace-priority candidate with compatible candidates in other visible namespaces, then identify tests covering resolution warnings. Done means module load warns with both candidate names when the chosen signature is strictly less specific.

Written by the indexing model from the issue text.

Description

enhancement
Description

Name resolution prefers the current namespace (and the priority namespaces) before it selects the more specific signature. So in a module whose namespace is the one of an abstract base-class property, an unqualified reference for an object of a subclass declared in another namespace binds to the abstract property of the base class, not to the subclass's own property of the same name — silently:

MODULE NsBase;
NAMESPACE Doc;
CLASS ABSTRACT Document;
date = ABSTRACT DATE (Document);

MODULE NsSub;
REQUIRE NsBase;
NAMESPACE Sub;
CLASS Invoice : Document;
date = DATA DATE (Invoice);

MODULE NsUse;
REQUIRE NsBase, NsSub;
NAMESPACE Doc;
invoiceDate (Invoice i) = date(i);   // Doc.date[Document], not Sub.date[Invoice]

The abstract property has no implementation for the subclass, so the values are NULL: a form filter on them drops every row and the columns are empty. The IDE inspection reports nothing and the server starts cleanly; the same expression in an eval script (another namespace) works, which hides the cause. The fix is to qualify the reference (Sub.date(i)).

Reason

The failure is silent and survives inspection and startup; it is found only by looking at the data.

Fix

At module load, when the candidate chosen by the namespace priority has a strictly less specific signature than a compatible candidate of another visible namespace, emit a warning naming both candidates (as the ambiguous-name error does), so that the developer can qualify the reference.

Dominant language
Java
Stars
214
Forks
46
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lsfusion/platform

All issues in lsfusion/platform

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.