Fix aspect processing when same dep appears in 2 attributes.

If a target appeared in 2 different attributes, it is not processed twice, even if different aspects were applied to the different attributes. In that case, only one of the aspects is applied. This commit fixes this by checking which aspects have been applied to the target, instead of checking if the target was already processed.

PiperOrigin-RevId: 156738275
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
index 54ea96c..5ea7fd8 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/AspectTest.java
@@ -376,6 +376,18 @@
   }
 
   @Test
+  public void sameTargetInDifferentAttributesWithDifferentAspects() throws Exception {
+    setRulesAvailableInTests(new TestAspects.BaseRule(), new TestAspects.MultiAspectRule(),
+        new TestAspects.SimpleRule());
+    pkg("a",
+        "multi_aspect(name='a', foo=':b', bar=':b')",
+        "simple(name='b')");
+
+    ConfiguredTarget a = getConfiguredTarget("//a:a");
+    assertThat(a.getProvider(RuleInfo.class).getData()).containsExactly("foo", "bar");
+  }
+
+  @Test
   public void informationFromBaseRulePassedToAspect() throws Exception {
     setRulesAvailableInTests(new TestAspects.BaseRule(), new TestAspects.HonestRule(),
         new TestAspects.AspectRequiringProviderRule());