private void AddResult(Type t, IEnumerable <BoxedExpression> newInvariants) { IEnumerable <BoxedExpression> prevExpressions; // We already saw the type, and got top for it if (this.topInvariants.Contains(t)) { return; } if (this.inferredInvariants.TryGetValue(t, out prevExpressions)) { if (ExtensionsForComparingSequencesOfBoxedExpression.IncludedIn(newInvariants, prevExpressions)) { if (newInvariants.Count() == prevExpressions.Count()) { #if DEBUG Console.WriteLine("Found the same invariant for {0}", t); #endif } else { #if DEBUG Console.WriteLine("Found a new invariant for {0}", t); Console.WriteLine("Previous invariant: {0}", ToString(prevExpressions)); #endif this.HasNewInvariants = true; this.inferredInvariants[t] = newInvariants; } } else { #if DEBUG Console.WriteLine("Removed invariant for {0}", t); #endif this.inferredInvariants.Remove(t); this.topInvariants.Add(t); } } else { #if DEBUG Console.WriteLine("Found new invariant for {0}", t); #endif this.HasNewInvariants = true; this.inferredInvariants[t] = newInvariants; } }
public IEnumerable <BoxedExpression> Join() { IEnumerable <BoxedExpression> result = null; foreach (var c in this.post.Values) { if (c == null) { continue; } if (result != null) { var cEnumerable = c.GetEnumerable(); Print("new value to intersect with", cEnumerable); // result = result.Intersect(cEnumerable); if (cEnumerable == null) { Print("Giving up, intersecting with null", null); return(null); } result = ExtensionsForComparingSequencesOfBoxedExpression.Intersection(result, cEnumerable); Print("result of the intersection", result); } else { result = c.GetEnumerable(); Print("First", result); } if (result == null || !result.Any()) { Print("Giving up", null); return(result); } } return(result); }