Skylark: proper anchor is generated for Boolean types in the documentation.

--
MOS_MIGRATED_REVID=89123292
diff --git a/src/main/java/com/google/devtools/build/docgen/SkylarkDocumentationProcessor.java b/src/main/java/com/google/devtools/build/docgen/SkylarkDocumentationProcessor.java
index b089720..deafa8a6 100644
--- a/src/main/java/com/google/devtools/build/docgen/SkylarkDocumentationProcessor.java
+++ b/src/main/java/com/google/devtools/build/docgen/SkylarkDocumentationProcessor.java
@@ -251,23 +251,25 @@
     return getTypeAnchor(returnType) + " of " + getTypeAnchor(generic1) + "s";
   }
 
-  private String getTypeAnchor(Class<?> returnType) {
-    if (returnType.equals(String.class)) {
+  private String getTypeAnchor(Class<?> type) {
+    if (type.equals(Boolean.class) || type.equals(boolean.class)) {
+      return "<a class=\"anchor\" href=\"#modules._top_level.bool\">bool</a>";
+    } else if (type.equals(String.class)) {
       return "<a class=\"anchor\" href=\"#modules.string\">string</a>";
-    } else if (Map.class.isAssignableFrom(returnType)) {
+    } else if (Map.class.isAssignableFrom(type)) {
       return "<a class=\"anchor\" href=\"#modules.dict\">dict</a>";
-    } else if (List.class.isAssignableFrom(returnType)) {
+    } else if (List.class.isAssignableFrom(type)) {
       // Annotated Java methods can return simple java.util.Lists (which get auto-converted).
       return "<a class=\"anchor\" href=\"#modules.list\">list</a>";
-    } else if (returnType.equals(Void.TYPE) || returnType.equals(NoneType.class)) {
+    } else if (type.equals(Void.TYPE) || type.equals(NoneType.class)) {
       return "<a class=\"anchor\" href=\"#modules." + TOP_LEVEL_ID + ".None\">None</a>";
-    } else if (returnType.isAnnotationPresent(SkylarkModule.class)) {
+    } else if (type.isAnnotationPresent(SkylarkModule.class)) {
       // TODO(bazel-team): this can produce dead links for types don't show up in the doc.
       // The correct fix is to generate those types (e.g. SkylarkFileType) too.
-      String module = returnType.getAnnotation(SkylarkModule.class).name();
+      String module = type.getAnnotation(SkylarkModule.class).name();
       return "<a class=\"anchor\" href=\"#modules." + module + "\">" + module + "</a>";
     } else {
-      return EvalUtils.getDataTypeNameFromClass(returnType);
+      return EvalUtils.getDataTypeNameFromClass(type);
     }
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java b/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java
index 3a457f9..f754ae8 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/MethodLibrary.java
@@ -582,7 +582,8 @@
 
   @SkylarkBuiltin(name = "bool", returnType = Boolean.class, doc = "Converts an object to boolean. "
       + "It returns False if the object is None, False, an empty string, the number 0, or an "
-      + "empty collection. Otherwise, it returns True.",
+      + "empty collection. Otherwise, it returns True. Similarly to Python <code>bool</code> "
+      + "is also a type.",
       mandatoryParams = {@Param(name = "x", doc = "The variable to convert.")})
       private static Function bool = new MixedModeFunction("bool",
           ImmutableList.of("this"), 1, false) {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
index 6b71f62..f173218 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleClassFunctions.java
@@ -192,7 +192,7 @@
       optionalParams = {
       @Param(name = "test", type = Boolean.class, doc = "Whether this rule is a test rule. "
              + "If True, the rule must end with <code>_test</code> (otherwise it cannot)."),
-      @Param(name = "attrs", doc =
+      @Param(name = "attrs", type = Map.class, doc =
           "dictionary to declare all the attributes of the rule. It maps from an attribute name "
           + "to an attribute object (see 'attr' module). Attributes starting with <code>_</code> "
           + "are private, and can be used to add an implicit dependency on a label."),