gobra icon indicating copy to clipboard operation
gobra copied to clipboard

Casting to a map does not allow for ok flag to be checked

Open ThomasMayerl opened this issue 7 months ago • 0 comments

If we have a function that takes some parameter of any type and we cast it to a map (by requiring that the parameter is a map dynamically), upon indexing the map, we are not given back the ok flag:

Logic error: Multi assignment of m_V2["test"] to Vector(entry_V2, ok_V2) is not supported
type MapStrAny map[string]interface{}

requires typeOf(obj) == type[MapStrAny]
requires let m := obj.(MapStrAny) in acc(m)
func tmp(obj interface{}) {
    m := obj.(MapStrAny)
    entry, ok := m["test"]
    if ok {

    } else {

    }
}

ThomasMayerl avatar Jun 19 '25 12:06 ThomasMayerl