code: public int dimensions(Type t) {
          int result = 0;
          while (t.hasTag(ARRAY)) {
              result++;
              t = elemtype(t);
          }
          return result;
      }
docs: The number of dimensions of an array type.