Skip to content

Generics are recognized as binary expressions #434

Open

Description

@stackmystack

Hello,

Generics are currently broken.

If I do this test:

================================================================================
Assign a container initialized
================================================================================

var a = new List<PointUi>(points) { point };

--------------------------------------------------------------------------------

(compilation_unit
  (global_statement
    (local_declaration_statement
      (variable_declaration
        type: (implicit_type)
        (variable_declarator
          name: (identifier)
          (object_creation_expression
            type: (generic_name
              (identifier)
              (type_argument_list
                (identifier)))
            arguments: (argument_list
              (argument
                (identifier)))
            initializer: (initializer_expression
              (identifier))))))))

it fails with this:

 1 failure:
 
 correct / expected / unexpected
   1. Assign a container initialized:
 
     (compilation_unit
       (global_statement
         (local_declaration_statement
           (variable_declaration
             type: (implicit_type)
             (variable_declarator
               name: (identifier)
-              (binary_expression
-                left: (binary_expression
-                  left: (object_creation_expression
-                    type: (identifier))
-                  right: (identifier))
-                right: (cast_expression
-                  type: (identifier)
-                  value: (initializer_expression
-                    (identifier)))))))))
+              (object_creation_expression
+                type: (generic_name
+                  (identifier)
+                  (type_argument_list
+                    (identifier)))
+                arguments: (argument_list
+                  (argument
+                    (identifier)))
+                initializer: (initializer_expression
+                  (identifier))))))))

Same happens with unintialized.

This doesn't get reproduced with lists of literals for instance:

var a = new List<int>();

I am trying to solve it, but if you could provide any pointers it would be of great help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions