Skip to content
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

Rewrite dotty to indent after #17522 #17618

Closed
wants to merge 5 commits into from
Closed

Conversation

adpi2
Copy link
Member

@adpi2 adpi2 commented May 30, 2023

Rewrite dotty to indent, using -indent -rewrite, to validate #17522.

adpi2 added 5 commits May 30, 2023 13:14
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
}
```
Comment on lines +116 to +120
def genArithmeticOp(tree: Tree, code: Int): BType = tree match
case Apply(fun @ DesugaredSelect(larg, _), args) =>
var resKind = tpeTK(larg)
var resKind = tpeTK(larg)

assert(resKind.isNumericType || (resKind == BOOL),
assert(resKind.isNumericType || (resKind == BOOL),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some fixed indentation here and below in this file.

def primitiveTypeMap: Map[Symbol, PrimitiveBType]
def primitiveTypeMap: Map[Symbol, PrimitiveBType]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fixed off-by-one indentation

Comment on lines -1514 to +1391
} else /*if (sym.isClassConstructor && isHijackedBoxedClass(sym.owner)) {
else /*if (sym.isClassConstructor && isHijackedBoxedClass(sym.owner)) {
None
} else*/ {
} else*/
Copy link
Member Author

@adpi2 adpi2 May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some preserved comments

Comment on lines -306 to +279
object *: {
object `*:`:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A back-quoted operator

@nicolasstucki
Copy link
Contributor

@adpi2 do we still need this PR open? Or should we close it once #17522 is merged?

@adpi2 adpi2 closed this Jul 13, 2023
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.

2 participants