mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
Check for sets before attempting to check for same Yield types
This commit is contained in:
parent
6f61463a48
commit
29b0d32fef
1 changed files with 11 additions and 0 deletions
11
src/Type.cc
11
src/Type.cc
|
@ -1903,6 +1903,11 @@ bool same_type(const Type& arg_t1, const Type& arg_t2, bool is_init, bool match_
|
||||||
if ( (tl1 || tl2) && ! (tl1 && tl2) )
|
if ( (tl1 || tl2) && ! (tl1 && tl2) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// If one is a set and one isn't, they shouldn't
|
||||||
|
// be considered the same type.
|
||||||
|
if ( (t1->IsSet() && ! t2->IsSet()) || (t2->IsSet() && ! t1->IsSet()) )
|
||||||
|
return false;
|
||||||
|
|
||||||
const auto& y1 = t1->Yield();
|
const auto& y1 = t1->Yield();
|
||||||
const auto& y2 = t2->Yield();
|
const auto& y2 = t2->Yield();
|
||||||
|
|
||||||
|
@ -2015,6 +2020,12 @@ bool same_type(const Type& arg_t1, const Type& arg_t2, bool is_init, bool match_
|
||||||
|
|
||||||
if ( ! same_type(tl1, tl2, is_init, match_record_field_names) )
|
if ( ! same_type(tl1, tl2, is_init, match_record_field_names) )
|
||||||
result = false;
|
result = false;
|
||||||
|
else if ( t1->IsSet() && t2->IsSet() )
|
||||||
|
// Sets don't have yield types because they don't have values. If
|
||||||
|
// both types are sets, and we already matched on the indices
|
||||||
|
// above consider that a success. We already checked the case
|
||||||
|
// where only one of the two is a set earlier.
|
||||||
|
result = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto& y1 = t1->Yield();
|
const auto& y1 = t1->Yield();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue