Bug - Fixed "new <record_type>()" function does not accept map type values for map type members

"new <record_type>()" function does not accept map type values for map type members

There are, as far as I know, two ways to populate a record in ASH. The first is to create the record, then assign values to each member of the record. The second is to create the record with the new <record_type>() function, a sort of constructor to which you can pass values for each member. These methods should be equivalent, as in this example:

Code:
record t
{
	int a;
	string b;
	boolean [int] c;
};

boolean [int] foo;
foo[1] = true;

t bar;
bar.a = 7;
bar.b = "blah";
bar.c = foo;

t baz = new t(7, "blah", foo);

However, running this code gives me the following error message:
boolean [int] found when boolean [int] expected for field #3 (c) (aaa.ash, line 16)

Er, yes, I passed you a boolean[int], which was what you expected? I'm not sure what else it might possibly want. If I'm just crazy and am doing something wrong, please let me know how I should be doing it!

This is in r8541, the most current build as of this writing.
 

Veracity

Developer
Staff member
In revision 8542, the following code:

Code:
record t
{
	int a;
	string b;
	boolean [int] c;
};

void prec( string name, t rec )
{
  print( name + ".a = " + rec.a );
  print( name + ".b = " + rec.b );
  foreach i, b in rec.c
    print( name + ".c[" + i + "] = " + b );
}

boolean [int] foo;
foo[1] = true;

t bar;
bar.a = 7;
bar.b = "blah";
bar.c = foo;

prec( "bar", bar );

boolean [int] foob;
foob[12] = false;

t baz = new t(7, "blah", foob);

prec( "baz", baz );

now gives:

> rnew

bar.a = 7
bar.b = blah
bar.c[1] = true
baz.a = 7
baz.b = blah
baz.c[12] = false
 
Top