Skip to content

Commit e08d0fd

Browse files
authored
fix indentation of diff blocks (#2728)
there should be a 1 space margin even when there is no line change
1 parent 741cd99 commit e08d0fd

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

Diff for: _overviews/scala3-migration/incompat-syntactic.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The [Scala 3 migration compilation](tooling-migration-mode.html) rewrites the co
6161

6262
- println(enum)
6363
+ println(`enum`)
64-
}
64+
}
6565
{% endhighlight %}
6666

6767
## Procedure Syntax
@@ -84,12 +84,12 @@ object Bar {
8484

8585
The [Scala 3 migration compilation](tooling-migration-mode.html) rewrites the code into.
8686
{% highlight diff %}
87-
object Bar {
87+
object Bar {
8888
- def print() {
8989
+ def print(): Unit = {
90-
println("bar")
91-
}
92-
}
90+
println("bar")
91+
}
92+
}
9393
{% endhighlight %}
9494

9595
## Parentheses Around Lambda Parameter
@@ -129,30 +129,30 @@ test("my test")
129129

130130
The [Scala 3 migration compiler](tooling-migration-mode.html) indents the first line of the block.
131131
{% highlight diff %}
132-
test("my test")
132+
test("my test")
133133
-{
134134
+ {
135-
assert(1 == 1)
136-
}
135+
assert(1 == 1)
136+
}
137137
{% endhighlight %}
138138

139139
This migration rule applies to other patterns as well, such as refining a type after a new line.
140140

141141
{% highlight diff %}
142-
type Bar = Foo
143-
- {
144-
+ {
145-
def bar(): Int
146-
}
142+
type Bar = Foo
143+
-{
144+
+ {
145+
def bar(): Int
146+
}
147147
{% endhighlight %}
148148

149149
A preferable solution is to write:
150150
{% highlight diff %}
151151
-test("my test")
152152
-{
153153
+test("my test") {
154-
assert(1 == 1)
155-
}
154+
assert(1 == 1)
155+
}
156156
{% endhighlight %}
157157

158158
## Wrong indentation
@@ -175,12 +175,12 @@ def bar: (Int, Int) = {
175175

176176
The indentation must be fixed.
177177
{% highlight diff %}
178-
def bar: (Int, Int) = {
179-
val foo = 1.0
180-
val bar = foo
178+
def bar: (Int, Int) = {
179+
val foo = 1.0
180+
val bar = foo
181181
- (1, 1)
182182
+ (1, 1)
183-
}
183+
}
184184
{% endhighlight %}
185185

186186
These errors can be prevented by using a Scala formatting tool such as [scalafmt](https://scalameta.org/scalafmt/) or the [IntelliJ Scala formatter](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html).

0 commit comments

Comments
 (0)