ergo icon indicating copy to clipboard operation
ergo copied to clipboard

Printing branded values with no brands is wrong

Open kach opened this issue 7 years ago • 3 comments

define concept A {}
define concept B {}

emit A {};
emit B {};
return;
Emit. B{}
Emit. A{} : ~[multiple][]
Response. unit : Unit

The printed output ~[multiple][] suggests that the inferred type has multiple brands, which is wrong. The reality is that the inferred output type is a branded value with no brands. This is a pathological case but clearly it can happen…


P.S. this works as expected

define concept X {}
define concept A extends X {}
define concept B extends X {}

emit A {};
emit B {};
return;
Emit. B{}
Emit. A{} : X[]
Response. unit : Unit

kach avatar Aug 16 '18 23:08 kach

If we had a "top" concept, then that could be the brand printed in this case. This would also help fix #387 I think.

kach avatar Aug 17 '18 00:08 kach

WIP:

define concept A {}
define concept B {}

emit A {};
emit B {};
return
Emit. B{}
Emit. A{} : <>[]
Response. unit : Unit

if true then emit A{}; return else emit B{}; return
Emit. A{} : <>[]
Response. unit : Unit

This prints multiple brands within <> when there is multiple ones, although I don't believe there is a way to create such a type at the moment.

jeromesimeon avatar Jan 29 '19 18:01 jeromesimeon

I do like the idea of a Top concept. The issue is whether we would consider different kinds of classes (transaction, event, concept, ...) to be under a Top concept, in which case we can still have the same behavior with:

define concept A {}
define event B {}

emit A {};
emit B {};
return
Emit. B{}
Emit. A{} : <>[]
Response. unit : Unit

jeromesimeon avatar Jan 29 '19 18:01 jeromesimeon