Allow aspects to get the value of implicit attributes.

PiperOrigin-RevId: 620022915
Change-Id: I8b129ab84f0348421347677e0aaa7827994b2850
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java
index badca6d..95a4cf6 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/AspectAwareAttributeMapper.java
@@ -71,6 +71,8 @@
         throw new IllegalArgumentException(String.format(
             "attribute %s has type %s, not expected type %s",
             attributeName, attribute.getType(), type));
+      } else if (attribute.isImplicit()) {
+        return type.cast(attribute.getDefaultValue(/* rule= */ null));
       } else {
         throw new UnsupportedOperationException(
             String.format(