simple-graph-query 2.8.1 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -49502,25 +49502,21 @@ class ForgeExprEvaluator extends AbstractParseTreeVisitor_1.AbstractParseTreeVis
|
|
|
49502
49502
|
break;
|
|
49503
49503
|
case "in":
|
|
49504
49504
|
case "ni": {
|
|
49505
|
-
|
|
49506
|
-
//
|
|
49507
|
-
//
|
|
49508
|
-
|
|
49509
|
-
|
|
49510
|
-
|
|
49511
|
-
|
|
49512
|
-
|
|
49513
|
-
|
|
49514
|
-
|
|
49515
|
-
|
|
49516
|
-
|
|
49517
|
-
|
|
49518
|
-
|
|
49519
|
-
|
|
49520
|
-
else {
|
|
49521
|
-
// left is a tuple array but right is a single value, so false
|
|
49522
|
-
membershipResult = false;
|
|
49523
|
-
}
|
|
49505
|
+
// In Alloy/Forge everything is a relation, and a scalar is just a
|
|
49506
|
+
// singleton set. Lift any scalar operand to a singleton tuple so `in`
|
|
49507
|
+
// is uniformly subset:
|
|
49508
|
+
// a in b ({a} ⊆ {b}) -> equality when both are scalars
|
|
49509
|
+
// a in {..} ({a} ⊆ set) -> membership
|
|
49510
|
+
// {..} in b (set ⊆ {b}) -> subset of a singleton
|
|
49511
|
+
// isTupleArraySubset already returns true for equal sets and for an
|
|
49512
|
+
// empty left-hand set, so a single subset check covers every case.
|
|
49513
|
+
const leftSet = isSingleValue(leftChildValue)
|
|
49514
|
+
? [[leftChildValue]]
|
|
49515
|
+
: leftChildValue;
|
|
49516
|
+
const rightSet = isSingleValue(rightChildValue)
|
|
49517
|
+
? [[rightChildValue]]
|
|
49518
|
+
: rightChildValue;
|
|
49519
|
+
const membershipResult = isTupleArraySubset(leftSet, rightSet);
|
|
49524
49520
|
results = ctx.compareOp()?.text === "ni" ? !membershipResult : membershipResult;
|
|
49525
49521
|
break;
|
|
49526
49522
|
}
|
package/package.json
CHANGED