microsoft / Power-Fx

Power Fx low-code programming language
MIT License
3.21k stars 327 forks source link

Make Error( {Kind:”2” } ) work #1203

Closed MikeStall closed 1 year ago

MikeStall commented 1 year ago

This works: Error( {Kind: 2 } )

But this does not: Error( {Kind:"2" } )

and gets compile time error because it won't allow string to number coercion: Error 7-19: Invalid type for field 'Kind'. Expected field type of 'ErrorKind'.

We want to allow the string-to-number coercion and for 2nd one to work.

Fix is likely in: https://github.com/microsoft/Power-Fx/blob/2cace9a65b3a98e792ba0072cd2a2a4c9d27d191/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Error.cs#L44

nguhoa commented 1 year ago

Fixed in https://github.com/microsoft/Power-Fx/pull/1206