microsoft / Power-Fx

Power Fx low-code programming language
MIT License
3.18k stars 321 forks source link

Assert in structural print #2414

Closed MikeStall closed 4 months ago

MikeStall commented 4 months ago

StructuralPrint.Print on this expression will assert:

ShowColumns(Table, Name)

It asserts at 'Name', which does not have a valid type because it's a Column-as-identifer.

_typeMap[node.Id].Kind Invalid

The assert is ignorable.

    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Utils.Contracts.Assert(bool f) Line 447   C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Binding.TexlBinding.GetType(Microsoft.PowerFx.Syntax.TexlNode node) Line 477  C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Logging.StructuralPrint.IsExpandedType(Microsoft.PowerFx.Core.Binding.TexlBinding binding, Microsoft.PowerFx.Syntax.TexlNode node) Line 458   C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Logging.StructuralPrint.Visit(Microsoft.PowerFx.Syntax.FirstNameNode node, Microsoft.PowerFx.Syntax.Precedence parentPrecedence) Line 87  C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Syntax.FirstNameNode.Accept<Microsoft.PowerFx.Core.UtilityDataStructures.LazyList<string>, Microsoft.PowerFx.Syntax.Precedence>(Microsoft.PowerFx.Syntax.TexlFunctionalVisitor<Microsoft.PowerFx.Core.UtilityDataStructures.LazyList<string>, Microsoft.PowerFx.Syntax.Precedence> visitor, Microsoft.PowerFx.Syntax.Precedence context) Line 54   C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Logging.StructuralPrint.Visit(Microsoft.PowerFx.Syntax.ListNode node, Microsoft.PowerFx.Syntax.Precedence parentPrecedence) Line 351  C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Syntax.ListNode.Accept<Microsoft.PowerFx.Core.UtilityDataStructures.LazyList<string>, Microsoft.PowerFx.Syntax.Precedence>(Microsoft.PowerFx.Syntax.TexlFunctionalVisitor<Microsoft.PowerFx.Core.UtilityDataStructures.LazyList<string>, Microsoft.PowerFx.Syntax.Precedence> visitor, Microsoft.PowerFx.Syntax.Precedence context) Line 61    C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Logging.StructuralPrint.Visit(Microsoft.PowerFx.Syntax.CallNode node, Microsoft.PowerFx.Syntax.Precedence parentPrecedence) Line 331  C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Syntax.CallNode.Accept<Microsoft.PowerFx.Core.UtilityDataStructures.LazyList<string>, Microsoft.PowerFx.Syntax.Precedence>(Microsoft.PowerFx.Syntax.TexlFunctionalVisitor<Microsoft.PowerFx.Core.UtilityDataStructures.LazyList<string>, Microsoft.PowerFx.Syntax.Precedence> visitor, Microsoft.PowerFx.Syntax.Precedence context) Line 118   C#
    Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.Core.Logging.StructuralPrint.Print(Microsoft.PowerFx.Syntax.TexlNode node, Microsoft.PowerFx.Core.Binding.TexlBinding binding, Microsoft.PowerFx.Core.Logging.ISanitizedNameProvider nameProvider) Line 33 C#
>   Microsoft.PowerFx.Core.dll!Microsoft.PowerFx.CheckResult.ApplyGetLogging() Line 669 C#

It's also easy to hit this in visitors on FirstNameNode.

MikeStall commented 4 months ago

fixed with 2415.