Skip to content

Commit

Permalink
Printing better error message when PFx.V1 is active
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-joyle committed Dec 19, 2024
1 parent 5b7b1c5 commit 7070f7f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ private bool SetErrorForMismatchedColumnsCore(DType expectedType, DType actualTy
}

// Second, set column missing message if applicable
if (RequireAllParamColumns && !expectedType.AreFieldsOptional)
if ((RequireAllParamColumns || features.PowerFxV1CompatibilityRules) && !expectedType.AreFieldsOptional)
{
errors.EnsureError(
DocumentErrorSeverity.Severe,
Expand Down
5 changes: 0 additions & 5 deletions src/libraries/Microsoft.PowerFx.Core/Texl/Remove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ internal class RemoveFunction : BuiltinFunction, ISuggestionAwareFunction

public override bool MutatesArg(int argIndex, TexlNode arg) => argIndex == 0;

// !!!TODO this might be a problem.
public override bool RequireAllParamColumns => true;

public override bool ArgMatchesDatasourceType(int argNum)
{
return argNum >= 1;
Expand Down Expand Up @@ -348,8 +345,6 @@ internal class RemoveAllFunction : BuiltinFunction

public override bool MutatesArg(int argIndex, TexlNode arg) => argIndex == 0;

public override bool RequireAllParamColumns => true;

public override bool ArgMatchesDatasourceType(int argNum)
{
return argNum == 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public void DataTableEvalTest2()

var check = engine.Check("Remove(robintable, {Scores:10}, RemoveFlags.All)", options: opt);
Assert.False(check.IsSuccess);
Assert.Contains("ErrColumnMissing_ColName_ExpectedType", check.Errors.Select(err => err.MessageKey));

Assert.Equal(3, table.Rows.Count);
}
Expand Down

0 comments on commit 7070f7f

Please sign in to comment.