Skip to content

Rewrite scala3-library and scala3-compiler to indent using #17522 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: insert-indent
Choose a base branch
from

Conversation

adpi2
Copy link
Owner

@adpi2 adpi2 commented May 26, 2023

No description provided.

adpi2 added 17 commits May 24, 2023 15:24
Ensure indentation is correct when removing braces.

If the first indentation of the region is greater than the indentation
of the enclosing region, we use it to indent the whole region.
Otherwise we use the incremented indentation of the enclosing region.

```scala
  def foo = {
        x // we replicate indentation of x downward in region
    y
  }
```

```scala
  def foo = {
x // indentation of x is incorrect, we increment enclosing indentation
  y
  }
```

A bigger indentation than the required one is permitted except
just after a closing brace.

```scala
def bar = {
  x
    .toString // permitted indentation
  def foo = {
  }
    bar //  must be unindented, to not fall into the body of foo
}
```
The main reason is that it breaks the non-bootstrapped compilation.
Also it is ugly to mix leading operators with back-ticks and without them:
 ```
 x
 || y
 `||` :
   z
|| u
```

The change can easily be reverted later.
@adpi2 adpi2 changed the title Rewrite scala3-library and scala3-compiler to indent using https://github.com/lampepfl/dotty/pull/17522 Rewrite scala3-library and scala3-compiler to indent using #17522 May 26, 2023
@adpi2 adpi2 force-pushed the insert-indent branch 9 times, most recently from ce73d29 to de1558d Compare June 1, 2023 08:37
@adpi2 adpi2 force-pushed the insert-indent branch 3 times, most recently from acbbc94 to 5657b69 Compare June 13, 2023 14:18
@adpi2 adpi2 force-pushed the insert-indent branch 2 times, most recently from 0ebb797 to 3549ff2 Compare June 19, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant