A DATE parameter loses its class under + / - : `p - 7` is inferred as INTEGER, while `prop(x) - 7` and `currentDate() - 7` stay DATE
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start with the self-contained DateParamRepro module and reproduce the load-time errors for DATE parameters using p - 7 and p + 7; compare them with the working property and function cases. Trace the DATE arithmetic type inference and verify that parameter expressions retain DATE while the existing sum and explicit DATE workarounds remain valid.
Written by the indexing model from the issue text.
Description
Arithmetic on a parameter of class DATE does not keep the DATE class: p - 7 is inferred as INTEGER, so the expression is rejected everywhere a DATE is required. The same arithmetic on a DATE-valued property or function is accepted.
The computed value is never wrong — only the inferred class is. The failure is therefore a load-time type error, not a data problem.
Reproduction
A self-contained module. Add DateParamRepro to the top module's REQUIRE and start the server.
MODULE DateParamRepro;
REQUIRE System, Utils, Time;
CLASS Sample 'Sample';
day 'Day' = DATA DATE (Sample);
// the parameter itself is a perfectly good DATE
plain (Sample s, DATE p) { day(s) <- p; } // OK
// ... but arithmetic on it is not
minusParam (Sample s, DATE p) { day(s) <- p - 7; } // FAILS
Observed
Each construct was checked on its own, because one semantic error is reported per load:
| construct | result |
|---|---|
day(s) <- p; |
OK — the parameter is a DATE |
day(s) <- p - 7; |
ASSIGN's arguments' types don't match |
day(s) <- p + 7; |
ASSIGN's arguments' types don't match |
older (Sample s, DATE p) = TRUE IF day(s) < p - 7; |
value of class 'DATE' is not comparable with value of class 'INTEGER' |
day(s) <- DATE(p - 7); |
OK |
day(s) <- sum(p, -7); |
OK |
day(s) <- day(s) - 7; |
OK — property on the left |
day(s) <- currentDate() - 7; |
OK — function on the left |
The comparison case is the informative one: it names the inferred class outright, so p - 7 is coming out as INTEGER.
The last two rows are the contrast that makes this look like a bug rather than a deliberate restriction — the very same <expr> - 7, differing only in whether the left operand is a parameter or a property/function, is accepted.
The value is correct
Only the inference is affected. Checked at runtime through /eval with p = 2026-08-21:
run(DATE p) {
RETURN 'p-7 raw=' + STRING[30](p - 7)
+ ' | DATE(p-7)=' + STRING[30](DATE(p - 7))
+ ' | sum(p,-7)=' + STRING[30](sum(p, -7));
}
p-7 raw=2026-08-14 | DATE(p-7)=2026-08-14 | sum(p,-7)=2026-08-14
All three forms produce the right date, so DATE(p - 7) is a genuine workaround rather than a cast that papers over a wrong value.
Expected
DATE ± INTEGER should yield DATE regardless of whether the left operand is a parameter, a property or a function — matching sum[DATE, INTEGER] and subtract[DATE, LONG] from Time.
Why it is easy to get wrong
The two error messages point in different directions, and neither mentions the parameter:
ASSIGN's arguments' types don't matchnames neither operand class nor the parameter, so from the assignment alone the natural (and wrong) conclusion is thatDATE ± INTEGERis simply not assignable to aDATEproperty.- Only the comparison message names
INTEGER, and a codebase can easily have no comparison on a parameter — everycurrentDate() + NanddateProp(x) - Nin it keeps working, which hides the pattern.
If the current behaviour turns out to be intended, an error message naming the parameter and its inferred class would already remove most of the confusion.
Workarounds
day(s) <- sum(p, -7); // Time helper - preferred
day(s) <- DATE(p - 7); // explicit cast, verified to give the same value
Environment
- lsFusion 7.0-SNAPSHOT, build 392
- Java 17.0.9, Windows 11, PostgreSQL 18
- Reproduced at load time — both on a normal server start and with
-Dsettings.dryRun=true
Only DATE was checked; DATETIME and TIME parameters were not tested.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lsfusion/platform
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
All issues in lsfusion/platform
Similar issues
-
account assessment course feature lecture
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
app:learninggoalhub enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyPossibly taken @vaibhavgupta443 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/wicket#1991 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100