import org.jetbrains.annotations.*;

final class Foo {
  @<warning descr="@Nullable method 'foo' always returns a non-null value">Nullable</warning> Object foo(int param) {
    return param == 1 ? new Object() {
      Object unrelated() {
        return <warning descr="'null' is returned by the method which is not declared as @Nullable">null</warning>;
      }
    } : bar();
  }

  @NotNull Foo bar() {
    return this;
  }

  @Nullable
  Object throwing() {
    throw new UnsupportedOperationException();
  }
}

@@ -506,10 +506,107 @@
 ();%0A  %7D%0A
+  %0A  @Nullable%0A  String s(String foo) %7B%0A    if (!foo.isEmpty()) return foo;%0A    return null;%0A  %7D%0A
 %7D%0A

Test for IDEA-232076/IDEA-CR-58012