Algebraic changing type when in associative array

rikki cattermole rikki at cattermole.co.nz
Tue Feb 4 13:26:55 UTC 2020


On 05/02/2020 2:11 AM, Paul Backus wrote:
> On Tuesday, 4 February 2020 at 11:45:50 UTC, rous wrote:
>> I'm defining an Algebraic type like this:
>> alias Expr = Algebraic!(This[char], string, int);
>> However, when I create an Expr from an associative array of chars and 
>> Exprs, the Exprs seem to change from Algebraic to VariantN!32LU types. 
>> This is illustrated in the following error message:
>> cannot pass argument ex.opIndex(' ') of type VariantN!32LU to 
>> parameter VariantN!(16LU, This[char], string, int) ex
>> when I try to call a function that takes an Expr with ex[' '].
>> If there is no way to ensure that it does not change type, is there a 
>> way to cast it back?
> 
> Can you post an example program that illustrates the error? You 
> shouldn't be getting two different sizes (16 and 32) for the same 
> Algebraic type.

I missed this when I commented previously as there is two questions in 
the original post. My bad rous!


More information about the Digitalmars-d-learn mailing list