Skip to content

Different indentation level changes behaviour of the code #1019

Open
@smoothdeveloper

Description

@smoothdeveloper
let foo t = "(" + t + ")"

let tttt =
  let text =
    match Some "" with
    | Some t ->
      match t with
      | "" ->
        "a"
      | "b" ->
        "b"
      |> foo
    | _ -> "fooo"
  text  

let tttt' =
    let text =
        match Some "" with
        | Some t ->
            match t with
            | "" ->
                "a"
            | "b" ->
                "b"
            |> foo
        | _ -> "fooo"
    text

In foo I use two spaces for indentation, in foo' four spaces are used.

The resulting expressions are different while I'd had expected those to be the same.

I tried to find something which would explain that in the language specification (which I haven't thoroughly read) but failed, and the behaviour seems to fail me at "principle of least surprise" so submitting this as an issue to get clarification.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions