julian-klode/lingolang

Unsound container permissions possible

julian-klode opened this issue · 3 comments

It is possible to create unsound permissions for structs, array, slices, and maps, such as
or struct { om } (read-only struct containing mutable value).

convertTo probably should restrict element permissions to the outer permission, using an intersection.

Alternatively, one could introduce a consistency pass that either makes a permission consistent or checks consistency of a permission. This would keep convertTo()'s job limited to extending a (partial) annotation permission to a given type permission (by converting the type permission to the annotation).

A consistency pass should also allow us to implement #3.

Silly me, that should be handled by convert(p, p.GetBasePermission()) after convert(typePermission, annotation).