microsoft / microsoft/Power-Fx

Switch doesn't handle number-to-decimal conversion in its match arguments

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

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

An expression such as Switch(template, match1, result1, match2, result2, resultOther) should be equivalent to If(template = match1, result1, template = match2, result2, resultOther). But if there is a decimal/float mismatch in the template/match in the Switch function, it does not work:

Switch(1, 2, "From decimal", Float(1), "From float", "other")

While

If(1 = 2, "From decimal", 1 = Float(1), "From float", "other")

Does work.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by tracing the Switch and If expression entry points and compare how their match arguments handle decimal/float equality. Reproduce the examples from the issue, then add regression coverage showing equivalent results for Switch; done means the decimal/float case returns the same result as If.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.