Power-Fx icon indicating copy to clipboard operation
Power-Fx copied to clipboard

Smmarize should have a compile time error for Identifier as Name

Open gregli-msft opened this issue 1 year ago • 0 comments

We should expliciltly check for and block all forms of "Identifier As Name", including if the identifier is in the row scope of the table or is a global variable outside. We do this so we can support group by column renaming in the future.

>> Summarize( [1,2,3], Value)
[1, 2, 3]

>> Summarize( [1,2,3], Value, Average( ThisGroup, Value ) As A )

  A   Value
 === =======
  1   1
  2   2
  3   3

>> Summarize( [1,2,3], Value, Value As A )  // this should have a compile time error, certainly not this runtime error
One or more errors occurred. (Unable to cast object of type 'Microsoft.PowerFx.Types.DecimalType' to type 'Microsoft.PowerFx.Types.TableType'.)

>> Set( Global, 1 )
Global: 1

>> Summarize( [1,2,3], Value, Global As A ) // this should have a compile time error too

  A   Value
 === =======
  1   1
  1   2
  1   1

gregli-msft avatar May 04 '24 15:05 gregli-msft