Example #1
0
 public virtual void Method([CanBeNull] string a)
 {
     ReSharper.TestValueAnalysis(a /*Expect:AssignNullToNotNullAttribute*/, a == null);
 }
Example #2
0
        public void MethodWithNullableInt([NotNull] int?nullableInt /*Expect:NotNullOnImplicitCanBeNull[Implicit]*/)
        {
            // R# ignores the [NotNull] here, but respects it at the call site.

            ReSharper.TestValueAnalysis(nullableInt /*Expect:AssignNullToNotNullAttribute*/, nullableInt == null);
        }
Example #3
0
 public async Task Method(string a)
 {
     ReSharper.TestValueAnalysis(a, a == null /*Expect:ConditionIsAlwaysTrueOrFalse[MIn]*/);
     await Async.NopTask;
 }
 public string OverriddenNullabilityInDerived([CanBeNull] string a)
 {
     // Here the explicit NotNull/CanBeNull overrides the base annotation.
     ReSharper.TestValueAnalysis(a /*Expect:AssignNullToNotNullAttribute*/, a == null);
     return(null /*Expect:AssignNullToNotNullAttribute*/);
 }
 public string ExplicitNotNullInBase(string a)
 {
     // Here the implicit NotNull matches with the base class.
     ReSharper.TestValueAnalysis(a, a == null /*Expect:ConditionIsAlwaysTrueOrFalse*/);
     return(null /*Expect:AssignNullToNotNullAttribute*/);
 }
 public IEnumerable <object> SomeIterator(string str)
 {
     ReSharper.TestValueAnalysis(str, str == null /*Expect:ConditionIsAlwaysTrueOrFalse[MIn]*/);
     yield break;
 }