Commit caa821f
authored
Updated option set testing (#2446)
Fixes a bug in Canvas apps coercing an option set value to number. There
were missing checks for pre-V1 semantics in DType.cs.
But this bug, along with the other recent fixes, is because we were not
testing with actual option sets, instead relying on enums since those
can be built for all the backing kinds. In general, enums and option
sets aren't that different in V1, but they are very different in pre-V1
which is what Canvas uses today. This has been corrected in this PR. We
now run tests with the test enums registered as option sets instead,
mimicing the semantics in Canvas for Dataverse number and Boolean option
sets. These new typed option sets are not exposed generally, as we
should look at that implementation more closely, today it translates
between string values more than it needs to.
By doing this testing, another bug was found in the interpeter, where we
weren't back converting boolean values to the option set, for example in
`Text( If( false, OptionSet.Value, true ) )`. C# now has the same
semantics as Canvas for Booleans. Number and other backing kinds may
also want this behavior long term, but since those aren't yet supported
we have time to decide how to handle that scenario. Without any changes,
a `CalculatedOptionSetValue` will be returned for the label if coerced
to a string, but the value itself will be correct.1 parent 0f75d9f commit caa821f
8 files changed
Lines changed: 2346 additions & 5 deletions
File tree
- src
- libraries
- Microsoft.PowerFx.Core/Types
- Microsoft.PowerFx.Interpreter/Functions
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3414 | 3414 | | |
3415 | 3415 | | |
3416 | 3416 | | |
3417 | | - | |
| 3417 | + | |
3418 | 3418 | | |
3419 | 3419 | | |
3420 | 3420 | | |
| |||
3435 | 3435 | | |
3436 | 3436 | | |
3437 | 3437 | | |
3438 | | - | |
| 3438 | + | |
3439 | 3439 | | |
3440 | 3440 | | |
3441 | 3441 | | |
| |||
3518 | 3518 | | |
3519 | 3519 | | |
3520 | 3520 | | |
3521 | | - | |
| 3521 | + | |
3522 | 3522 | | |
3523 | 3523 | | |
3524 | 3524 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
1070 | 1072 | | |
1071 | 1073 | | |
1072 | 1074 | | |
1073 | | - | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1074 | 1089 | | |
1075 | 1090 | | |
1076 | 1091 | | |
| |||
Lines changed: 48 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
276 | 296 | | |
277 | 297 | | |
278 | 298 | | |
| |||
284 | 304 | | |
285 | 305 | | |
286 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
287 | 316 | | |
288 | 317 | | |
289 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
290 | 334 | | |
291 | 335 | | |
292 | 336 | | |
| |||
724 | 768 | | |
725 | 769 | | |
726 | 770 | | |
727 | | - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
728 | 775 | | |
729 | 776 | | |
730 | 777 | | |
| |||
0 commit comments