Skip to content

Commit

Permalink
#314: DataFail when making a comparison with a 'null' value.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenHilferink committed Sep 5, 2023
1 parent 545f7b8 commit bc79b0b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
9 changes: 9 additions & 0 deletions clc/dll/src/OperAttrBin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,16 @@ template <typename P> struct dist_func: binary_func<typename dist_type<P>::type,
// *****************************************************************************

template <typename T> struct compare_func : binary_func<Bool, T, T> {
using base_class = binary_func<Bool, T, T>;

static ConstUnitRef unit_creator(const AbstrOperGroup* gr, const ArgSeqType& args) { return compare_unit_creator(gr, args, true); }

Bool operator()(T a, T b) const
{
if (!IsDefined(a) || !IsDefined(b))
throwDmsErrD("Invalid attempt to compare undefined values!");
return base_class::operator()(a, b);
}
};

template <typename T> struct equal_to : compare_func<T> { Bool operator ()(typename equal_to::arg1_cref a, typename equal_to::arg2_cref b) const { return a == b; } };
Expand Down
25 changes: 10 additions & 15 deletions tic/dll/src/TreeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2675,7 +2675,7 @@ TreeItem* TreeItem::WalkCurrSubTree(TreeItem* curr) // this acts as subTreeRoot

ActorVisitState TreeItem::VisitSuppliers(SupplierVisitFlag svf, const ActorVisitor& visitor) const
{
dms_assert(!SuspendTrigger::DidSuspend()); // precondition
assert(!SuspendTrigger::DidSuspend()); // precondition

if (GetTreeParent() && GetTreeParent()->m_State.GetProgress() < PS_MetaInfo && !GetTreeParent()->WasFailed(FR_MetaInfo))
GetTreeParent()->UpdateMetaInfo();
Expand Down Expand Up @@ -2723,7 +2723,7 @@ ActorVisitState TreeItem::VisitSuppliers(SupplierVisitFlag svf, const ActorVisit
return AVS_SuspendedOrFailed;
}
}
dms_assert(!SuspendTrigger::DidSuspend()); // precondition
assert(!SuspendTrigger::DidSuspend()); // precondition

// =============== look for explicit suppliers

Expand All @@ -2733,27 +2733,22 @@ ActorVisitState TreeItem::VisitSuppliers(SupplierVisitFlag svf, const ActorVisit
for (UInt32 i = 0; i < n; ++i)
{
const Actor* supplier = GetSupplCache()->begin(this)[i];
dms_assert(!SuspendTrigger::DidSuspend()); // precondition
assert(!SuspendTrigger::DidSuspend()); // precondition
if (!supplier)
continue;
if (visitor(supplier) == AVS_SuspendedOrFailed)
return AVS_SuspendedOrFailed;

dms_assert(!SuspendTrigger::DidSuspend()); // precondition
assert(!SuspendTrigger::DidSuspend()); // precondition
auto supplTI = debug_cast<const TreeItem*>(supplier); // all configured suppliers are TreeItems; all implied suppliers are AbstrCalculators
if (supplTI->VisitConstVisibleSubTree(visitor) == AVS_SuspendedOrFailed)
return AVS_SuspendedOrFailed;
}
}

dms_assert(!SuspendTrigger::DidSuspend()); // precondition
assert(!SuspendTrigger::DidSuspend()); // precondition
// Ask ParseResult for suppliers

// dms_assert(!Test(svf, SupplierVisitFlag::Calculator));
/* REMOVE
if (Test(svf, SupplierVisitFlag::Calculator)) // already done by StartInterest
if (visitor(GetCalculator()) == AVS_SuspendedOrFailed)
return AVS_SuspendedOrFailed;
*/

// =============== m_Calculator related
if (Test(svf, SupplierVisitFlag::DetermineCalc))
MakeCalculator(); // sets mc_Calculator, mc_DC, and mc_RefItem;
Expand Down Expand Up @@ -2781,7 +2776,7 @@ ActorVisitState TreeItem::VisitSuppliers(SupplierVisitFlag svf, const ActorVisit
if (mc_RefItem)
{
if (Test(svf, SupplierVisitFlag::SourceData))
if (visitor.Visit(mc_RefItem) != AVS_Ready)
if (visitor(mc_RefItem) != AVS_Ready)
return AVS_SuspendedOrFailed;
}

Expand Down Expand Up @@ -2811,9 +2806,9 @@ ActorVisitState TreeItem::VisitSuppliers(SupplierVisitFlag svf, const ActorVisit
if (Test(svf, SupplierVisitFlag::Checker) && HasIntegrityChecker())
{
auto icResult = MakeResult(GetIntegrityChecker());
if (visitor(icResult) == AVS_SuspendedOrFailed)
if (visitor.Visit(icResult) == AVS_SuspendedOrFailed)
return AVS_SuspendedOrFailed;
if (visitor(icResult->GetOld()) == AVS_SuspendedOrFailed)
if (visitor.Visit(icResult->GetOld()) == AVS_SuspendedOrFailed)
return AVS_SuspendedOrFailed;
}
return base_type::VisitSuppliers(svf, visitor);
Expand Down

0 comments on commit bc79b0b

Please sign in to comment.