Fix Aggregate types in UDF
Changes behavior of aggregate types like records and tables in User Defined Functions (UDFs) Add stricter type checking (restrict allowing more fields than expected) for aggregate types in UDF argument and return.
✅ No public API change.
public void CheckTypesOnDeclaration(CheckTypesContext context, DType actualBodyReturnType, TexlBinding binding)
Not related to your changes, but since you are touching this file: this function is only used in this class (8 lines above). Can you make it private?
Refers to: src/libraries/Microsoft.PowerFx.Core/Functions/UserDefinedFunction.cs:188 in 00c51ac. [](commit_id = 00c51ac12962a3bdb0744c51548ec95600a9a5d2, deletion_comment = False)
✅ No public API change.
public bool AreFieldsOptional { get; set; } = false;
I know this was already there, but there is an assumption that a DType is immutable. And this breaks it - and in your test code you're using it... Not a blocker for this PR, but consider filing an issue to clean it up.
Refers to: src/libraries/Microsoft.PowerFx.Core/Types/DType.cs:217 in 944c1a4. [](commit_id = 944c1a42cb9977b869103875bc22aa46f737ca9d, deletion_comment = False)