Skip to content

Commit

Permalink
add tests and issue link
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Aug 19, 2024
1 parent 564b1ba commit 5a8bdd6
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1886,16 +1886,20 @@ public void intersectionTypeInvalidAssign() {
"public class Test {",
" interface A<T extends @Nullable Object> {}",
" static class B implements A<@Nullable String>, Serializable {}",
" static class C implements A<String>, Serializable {}",
" static void test1(Object o) {",
" var x = (A<String> & Serializable) o;",
" // BUG: Diagnostic contains: Cannot assign from type B to type A<String> & Serializable",
" x = new B();",
" // ok",
" x = new C();",
" }",
" static class C implements A<String>, Serializable {}",
" static void test2(Object o) {",
" var x = (A<@Nullable String> & Serializable) o;",
// TODO: this assignment should be an error but we do not compute annotations in the
// type of x correctly
// TODO: should _not_ be an error, see https://github.com/uber/NullAway/issues/1022
" // BUG: Diagnostic contains: Cannot assign from type B to type A<String> & Serializable",
" x = new B();",
// TODO: _should_ be an error, see https://github.com/uber/NullAway/issues/1022
" x = new C();",
" }",
"}")
Expand Down

0 comments on commit 5a8bdd6

Please sign in to comment.