Skip to content

Reformat causes parse error when using semicolon in try #3492

@adamw

Description

@adamw

The following code formats fine:

object Test:
  def test =
    try
      1
      2
    catch
      case _: RuntimeException => 2
      case _: Exception        => 3

But if I change it to:

object Test:
  def test =
    try
      1; 2
    catch
      case _: RuntimeException => 2
      case _: Exception        => 3

This is reformatted as:

object Test:
  def test =
    try 1; 2
    catch
      case _: RuntimeException => 2
      case _: Exception        => 3

Which then causes a parse error in scalafmt.

My scalafmt conf file:

version = 3.7.2
maxColumn = 140
runner.dialect = scala3

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