microsoft / microsoft/Power-Fx
Fail hard coded strings in compile time in case of arithmetic operations
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.4k
- Forks
- 358
- Avg merge
- 10h 34m
- Merged PRs (30d)
- 3
Description
Change required for below -
Currently if we give hard coded strings in Value function, it is succeeded at compile time and at run time always give null, in my opinion it should fail at compile time as we know Value function always return decimal and string would never be able to parse to decimal [ex. Value("ab")]
Similarly if we give expression (1+2+"ab"), it passes at compile time right now but gives null at run time bcz IR returns Decimal("ab") which again uses same Value function.
Expressions like this should also fail at IR instead of passing at compile time and giving null at run time.
Below behavior is already there so no change required for below
Only fields with String type should be allowed in arithmetic operation as those fields value can be number at run time which can be parsed to decimal (ex. 1+2+field here field is of type string and field value is "5" so at run time expression will give 1+2+5=8)
Contributor guide
No contributing guide indexed for this repository
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 by tracing the Value function and the IR handling for arithmetic expressions containing hard-coded strings. Check how compile-time validation treats Value("ab") and expressions such as (1+2+"ab"), while preserving the existing behavior for string-typed fields; done means invalid literals fail at compile time and valid field expressions remain allowed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100