code: public static boolean isAllowedKeyType(SoyType type) {
      switch (type.getKind()) {
        case BOOL:
        case INT:
        case FLOAT:
        case STRING:
        case PROTO_ENUM:
          return true;
        default:
          return type == SoyTypes.NUMBER_TYPE;
      }
    }
docs: Whether the type is permissible as a key in a Soy {@code map} ({@link MapType}).