Negative sign change on Duration Datatype
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 881
- Forks
- 285
- Avg merge
- 3d 36m
- Merged PRs (30d)
- 1
Description
You cannot change sign to negative for Duration datatype. Error is: Operator '-' is ambiguous on an operand of type 'Duration'.
Sample of Code that gives an error:
if ShortenMaxDuration then
MaxDuration := -EscalationDuration
else
MaxDuration := EscalationDuration;
Expected behavior
I expect that MaxDuration gets negative value (as any numeric value).
MaxDuration = 0
EscalationDuration = 1000;
MaxDuration = -EscalationDuration
should give:
MaxDuration = -1000;
Versions:
AL Extension Version: 3.0.106655
- Business Central: 14.0.29530.0
Thanks,
Zoran
Contributor 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.
Research direction
Start with the Duration unary-minus example in the issue and reproduce the ambiguous '-' diagnostic using the listed AL Extension and Business Central versions. Trace the compiler handling for Duration operands and verify completion when assigning -EscalationDuration to MaxDuration produces the expected negative value without an ambiguity error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100