Skip to content

Commit

Permalink
Repro for b/227521723
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 438529381
  • Loading branch information
graememorgan authored and Error Prone Team committed Apr 17, 2023
1 parent d6d8a34 commit 654d672
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,25 @@ public void multimapIntegration() {
public void intersectionTypes() {
compilationHelper.addSourceFile("IncompatibleArgumentTypeIntersectionTypes.java").doTest();
}

@Test
public void typeWithinLambda() {
compilationHelper
.addSourceLines(
"Test.java",
"import com.google.common.collect.ImmutableList;",
"import com.google.errorprone.annotations.CompatibleWith;",
"import java.util.Map;",
"import java.util.Optional;",
"abstract class Test {",
" abstract <K, V> Optional<V> getOrEmpty(Map<K, V> map, @CompatibleWith(\"K\") Object"
+ " key);",
" void test(Map<Long, String> map, ImmutableList<Long> xs) {",
" // BUG: Diagnostic contains:",
" getOrEmpty(map, xs);",
" Optional<String> x = Optional.empty().flatMap(k -> getOrEmpty(map, xs));",
" }",
"}")
.doTest();
}
}

0 comments on commit 654d672

Please sign in to comment.