Skip to content

createInterface indents a copied type by its source column #9135

Closed

Description

@cknitt

createInterface copies a type declaration from the source with the column it has there as its indentation, instead of the indentation of the place it is printed at.

module Make = (X: {type t}) => {
  type u = X.t
}

generates

module Make: (
  X: {
                   type t
  },
) =>
{
  type u = X.t
}

type t is at column 19 in the source. Source_file_extractor.extract (analysis/src/create_interface.ml) prefixes the first line of the copied text with col_start spaces, and the Sig_type case of process_signature adds that text without its indent. A type in a module written on one line, such as module M = {type t = int}, is likely affected the same way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions