Check for constituent netclasses in DRC netclass equality checks

This reverts previous behaviour whereby 'A.Netclass == x' compared
the full name of an effective netclass (e.g. 'Class1,Default'). This
was found to be unexpected behaviour to users, who were expecting
the equality to compare single netclasses. The equality check now
first checks for a constituent class with the given name, and then
falls back to a check of the full class name.

Inequality requires the netclass name being tested to not be a
constituent netclass and to not be the full class name.
This commit is contained in:
JamesJCode
2025-03-05 20:30:54 +00:00
parent c108b20616
commit f0e287a87b
+23 -5
View File
@@ -166,18 +166,36 @@ public:
return *( m_item->GetEffectiveNetClass() )
== *( bValue->m_item->GetEffectiveNetClass() );
}
else
if( b->GetType() == LIBEVAL::VT_STRING )
{
return LIBEVAL::VALUE::EqualTo( aCtx, b );
if( m_item->GetEffectiveNetClass()->ContainsNetclassWithName( b->AsString() ) )
return true;
return m_item->GetEffectiveNetClass()->GetName() == b->AsString();
}
return LIBEVAL::VALUE::EqualTo( aCtx, b );
}
bool NotEqualTo( LIBEVAL::CONTEXT* aCtx, const LIBEVAL::VALUE* b ) const override
{
if( const PCBEXPR_NETCLASS_VALUE* bValue = dynamic_cast<const PCBEXPR_NETCLASS_VALUE*>( b ) )
return m_item->GetEffectiveNetClass() != bValue->m_item->GetEffectiveNetClass();
else
return LIBEVAL::VALUE::NotEqualTo( aCtx, b );
{
return *( m_item->GetEffectiveNetClass() )
!= *( bValue->m_item->GetEffectiveNetClass() );
}
if( b->GetType() == LIBEVAL::VT_STRING )
{
const bool isInConstituents =
m_item->GetEffectiveNetClass()->ContainsNetclassWithName( b->AsString() );
const bool isFullName = m_item->GetEffectiveNetClass()->GetName() == b->AsString();
return !isInConstituents && !isFullName;
}
return LIBEVAL::VALUE::NotEqualTo( aCtx, b );
}
protected: