inkytonik / cooma

The Cooma project is investigating secure programming language design based on fine-grained object capabilities.
Mozilla Public License 2.0
3 stars 2 forks source link

LUB not applied to elements of Vector expressions #53

Closed nhweston closed 2 years ago

nhweston commented 3 years ago

One would expect that [{ a = 1, b = 2 }, { b = 3 }] : Vector({ b : Int }). However, this is what actually happens:

cooma> [{ a = 1, b = 2 }, { b = 3 }]
1:2:error: all the elements in this vector must be of type { a : Int, b : Int }
[{ a = 1, b = 2 }, { b = 3 }]
 ^
inkytonik commented 3 years ago

I don't think any of the LUB stuff has made it to master yet. I haven't had time to finish that work... You may be able to work around it by declaring a type for the vector elements explicitly. E.g.,

 val x : Vector({b : Int)} = [...]

instead of using the literal directly.

inkytonik commented 2 years ago

Some WIP for this is in https://github.com/inkytonik/cooma/commit/48f7891bb36cf0b4a0a4288b9a657967b14c9b39. Feel free to adapt or abandon as appropriate.