Treat base->member as a dereference of base, for inference
PiperOrigin-RevId: 565356557
Change-Id: I6dde05cf3bd2180835e7340179ac20dce4c6646d
diff --git a/nullability/inference/collect_evidence_test.cc b/nullability/inference/collect_evidence_test.cc
index 696a7cd..4fca9e2 100644
--- a/nullability/inference/collect_evidence_test.cc
+++ b/nullability/inference/collect_evidence_test.cc
@@ -123,6 +123,22 @@
UnorderedElementsAre(
evidence(paramSlot(0), Evidence::UNCHECKED_DEREFERENCE)));
}
+TEST(CollectEvidenceFromImplementationTest, DerefArrow) {
+ static constexpr llvm::StringRef Src = R"cc(
+ struct S {
+ int x;
+ int y();
+ };
+ void target(S *a, S *b) {
+ a->x;
+ b->y();
+ }
+ )cc";
+ EXPECT_THAT(collectEvidenceFromTargetFunction(Src),
+ UnorderedElementsAre(
+ evidence(paramSlot(0), Evidence::UNCHECKED_DEREFERENCE),
+ evidence(paramSlot(1), Evidence::UNCHECKED_DEREFERENCE)));
+}
TEST(InferAnnotationsTest, DerefOfNonnull) {
static constexpr llvm::StringRef Src = R"cc(
void target(Nonnull<int *> p) {