Constraint problem

why size method doesn’t work for array when we use in expression

class array_size;
rand int a;
rand int x,y,z;
rand int len;

constraint array_c {
len inside {[200:300]};
a.size == len;
x.size + y.size + z.size == len; //not working
}
endclass

// Above code is not working and the tool is shouting error.
What is the best way to fix size for multiple array that depends on one variable

In reply to Maximus:

class array_size;
  rand int a[];
rand int x[],y[],z[];
rand int len;

constraint array_c {
//len inside {[200:300]};
  len > 200 && len < 300;
  a.size == len;
  x.size < len;
  y.size < len;
  z.size < len;
  x.size + y.size + z.size == len; //not working
}
endclass

module abc;
  
  array_size a1;
  
  initial begin
    a1 = new();
    a1.randomize();
    $display(a1.a.size(), a1.x.size(), a1.y.size(), a1.z.size());
  end
  
endmodule

This is working…