GetCandidatePostconditionsForAutoProperties <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> (IEnumerable <BoxedExpression> boxedExpressions, IDecodeMetaData <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> mdd, FieldsDB <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> fieldsDB) { var result = new List <Tuple <Method, BoxedExpression.AssertExpression, Provenance> >(); if (boxedExpressions != null) { foreach (var post in boxedExpressions.Where(exp => { return(exp.IsBinary); })) { Contract.Assume(post != null); BoxedExpression exp; if (post.IsCheckExpNotNotNull(out exp)) { var path = exp.AccessPath; if (path != null) { Method m; if (path[0].ToString() == "this" && path[path.Length - 1].IsMethodCall && path[path.Length - 1].TryMethod(out m) && mdd.IsAutoPropertyMember(m)) { Method setter; if (mdd.TryGetSetterFromGetter(m, out setter) && fieldsDB.IsCalledInANonConstructor(setter)) { #if DEBUG Console.WriteLine("[INFERENCE] Skipping the inference of the postcondition '{0}' to an autoproperty because found it is set in a non-constructor", post); #endif continue; } var t = mdd.ReturnType(m); var neqNull = BoxedExpression.Binary(BinaryOperator.Cne_Un, BoxedExpression.Result(t), BoxedExpression.Const(null, t, mdd)); #if DEBUG Console.WriteLine("[INFERENCE] Propagating the postcondition '{0}' to the autoproperty", post); #endif var p = new BoxedExpression.AssertExpression(neqNull, "ensures", APC.Dummy, null, null); result.Add(new Tuple <Method, BoxedExpression.AssertExpression, Provenance>(m, p, null)); } } } } } return(result); }