diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/Remove.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/Remove.cs index 4dcf71fde8..44448845de 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/Remove.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/Remove.cs @@ -120,8 +120,9 @@ public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DTyp if (!argType.IsRecord) { if (argCount >= 3 && i == argCount - 1 && - ((context.Features.PowerFxV1CompatibilityRules && BuiltInEnums.RemoveFlagsEnum.FormulaType._type.Accepts(argTypes[i], exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules)) || - (!context.Features.PowerFxV1CompatibilityRules && DType.String.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules)))) + ((!context.AnalysisMode && BuiltInEnums.RemoveFlagsEnum.FormulaType._type.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules)) || + (context.AnalysisMode && (DType.String.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules) || + BuiltInEnums.RemoveFlagsEnum.FormulaType._type.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules))))) { continue; } @@ -140,7 +141,10 @@ public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DTyp (!context.Features.PowerFxV1CompatibilityRules && (!collectionAcceptsRecord && !recordAcceptsCollection))) { fValid = false; - SetErrorForMismatchedColumns(collectionType, argType, args[i], errors, context.Features); + if (!SetErrorForMismatchedColumns(collectionType, argType, args[i], errors, context.Features)) + { + errors.EnsureError(DocumentErrorSeverity.Severe, args[i], TexlStrings.ErrTableDoesNotAcceptThisType); + } } // Only warn about no-op record inputs if there are no data sources that would use reference identity for comparison. @@ -148,22 +152,6 @@ public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DTyp { errors.EnsureError(DocumentErrorSeverity.Warning, args[i], TexlStrings.ErrCollectionDoesNotAcceptThisType); } - - if (!context.AnalysisMode) - { - // ArgType[N] (0> Remove(t4, {a:{aa:{aaa:true}}}) -Errors: Error 0-6: The function 'Remove' has some invalid arguments.|Error 11-30: Missing column. Your formula is missing a column 'a.aa.bbb' with a type of 'Boolean'.|Error 11-30: Invalid argument type. Expecting a Record value, but of a different schema.|Error 11-30: Missing column. Your formula is missing a column 'aa.bbb' with a type of 'Boolean'. +Errors: Error 0-6: The function 'Remove' has some invalid arguments.|Error 11-30: Missing column. Your formula is missing a column 'a.aa.bbb' with a type of 'Boolean'. >> Remove(t4, {a:{aa:{aaa:true,bbb:false}}}) Error({Kind:ErrorKind.NotFound})