code: public static Type inferType(Expression2 expression, Type rootType, TypeDeclaration typeDeclaration) {
      Map<Integer, Type> subexpressionTypeMap = inferTypeMap(expression, rootType, typeDeclaration);
      return subexpressionTypeMap.get(0);
    }
docs: Implementation of type inference that infers types for
  expressions using the basic type information in typeDeclaration.
  
  @param expression
  @param rootType
  @param typeDeclaration
  @return