Skip to content

Collection literal is parsed as ConstantNode #3500

@xuzhg

Description

@xuzhg

Describe the bug

Short summary (3-5 sentences) describing the issue.

Assemblies affected

Which assemblies and versions are known to be affected e.g. Microsoft.OData.Core 8.x

Steps to Reproduce

The collection literal such as "[1,2,3]" is read/parsed as ConstantNode.

It's same as "Id in (2,3,4)", where the parentheses literal is read as LiteralToken, then in the InBinder, to convert to CollectionConstantNode. That's not a "good" process.

It's same as "{"name": "Sam"}", where the brace literal is read as LiteralToken also.

Expected behaviour

For [], it should be parsed as collection.
For {}, if it's for function parameter template, it should be parsed as LiteralToken, for Json object, it should be parsed as a key value pairs.
for (), if it's for 'in' operator, it should be parsed as a collection, otherwise, it should be parsed as an expression.

Actual behaviour

  • Parsed as LiteralToken with all as a string.

Additional details

Optional, details of the root cause if known. Delete this section if you have no additional details to add.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions