zeek / spicy

C++ parser generator for dissecting protocols & files.
https://docs.zeek.org/projects/spicy
Other
246 stars 35 forks source link

Use a checked cast for `map`'s `in` operator. #1746

Closed bbannier closed 3 months ago

bbannier commented 4 months ago

We would previously assume that operand types in map's in operator were always resolved which is not the case, e.g., for this code x.b might be unresolved:

public type X = unit {
    var a: map<bytes, bytes>;
    : Y(self);
};

type Y = unit(x: X) {
    on %done { b"" in x.a; }
};

The implementation of set's in operator already accommodated this by defering until all types are resolved. This changes the implementation for map's in to follow a similar pattern.

Closes #1743.