Ticket #25 (new defect)

Opened 6 years ago

Variants are expanded too aggressively in linearization

Reported by: bringert Owned by:
Priority: minor Version:
Keywords: Cc:

Description

Now, all variants in arguments are lifted to the top level. This means that we often get repeated variants when there is suppression (and here, suppression includes not using all forms in a table, so it's quite common). For example:

test> l -all f g
foo
foo
bar
bar

test> l -record f g
variants {{s = "foo"};{s = "foo"};{s = "bar"};{s = "bar"}}

test> l -record g
{s = table {Sg => variants {"foo";"bar"};Pl => variants {"foos";"bars"}}}

The problem is that variants at the leaf level are lifted out of tables and records.

abstract test = {
cat S; A;
fun f : A -> S ;
    g : A ;
}
concrete testCnc of test = {
param Num = Sg | Pl ;
lincat A = { s : Num => Str } ;
lin f x = { s = x.s!Sg  };
    g = { s = table { Sg => variants {"foo";"bar"}; Pl => variants {"foos";"bars"}} } ;
}
Note: See TracTickets for help on using tickets.