Skip to content

Checker.ml raises error for empty EBufCreateL in [infer'] but not in [check'] #627

@Lin23299

Description

@Lin23299

In Checker.ml, it raises an error for empty EBufCreateL in infer' :

  | EBufCreateL (_, es) ->
      begin match es with
      | [] ->
          checker_error env "%a, there is an empty buf create sequence" ploc env.location
      | first :: others ->
          let t = infer env first in
          List.iter (check env t) others;
          TArray (t, (K.UInt32, string_of_int (List.length es)))
      end

While it is allowed in check':

| EBufCreateL (_, es) ->
      let t, _ = assert_buffer env t in
      List.iter (check env t) es

I wonder whether there is a reason for this design? Twic, I am trying to translate [T;N] to arr{T data[N];} in eurydice and this checker fails the check on the argument:

&({ data = stack newbuf {  }; }: arr)

while

stack newbuf {  }

is allowed.

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