Skip to content

Commit 524a129

Browse files
authored
Merge pull request #10733 from dotty-staging/rename-no-indent-setting
Rename the setting -noindent into -no-indent.
2 parents ef315c5 + be7162f commit 524a129

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
105105
val newSyntax: Setting[Boolean] = BooleanSetting("-new-syntax", "Require `then` and `do` in control expressions.")
106106
val oldSyntax: Setting[Boolean] = BooleanSetting("-old-syntax", "Require `(...)` around conditions.")
107107
val indent: Setting[Boolean] = BooleanSetting("-indent", "Together with -rewrite, remove {...} syntax when possible due to significant indentation.")
108-
val noindent: Setting[Boolean] = BooleanSetting("-noindent", "Require classical {...} syntax, indentation is not significant.")
108+
val noindent: Setting[Boolean] = BooleanSetting("-no-indent", "Require classical {...} syntax, indentation is not significant.", aliases = List("-noindent"))
109109
val YindentColons: Setting[Boolean] = BooleanSetting("-Yindent-colons", "Allow colons at ends-of-lines to start indentation blocks.")
110110

111111
/** Decompiler settings */

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ object Parsers {
603603
in.currentRegion = f(cur)
604604
try op finally in.currentRegion = cur
605605

606-
/** Parse `body` while checking (under -noindent) that a `{` is not missing before it.
606+
/** Parse `body` while checking (under -no-indent) that a `{` is not missing before it.
607607
* This is done as follows:
608608
* If the next token S is indented relative to the current region,
609609
* and the end of `body` is followed by a new line and another statement,

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class CompilationTests {
157157
compileFile("tests/neg-custom-args/infix.scala", defaultOptions.and("-source", "3.1", "-deprecation", "-Xfatal-warnings")),
158158
compileFile("tests/neg-custom-args/missing-alpha.scala", defaultOptions.and("-Yrequire-targetName", "-Xfatal-warnings")),
159159
compileFile("tests/neg-custom-args/wildcards.scala", defaultOptions.and("-source", "3.1", "-deprecation", "-Xfatal-warnings")),
160-
compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-noindent", "-Xfatal-warnings")),
160+
compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-no-indent", "-Xfatal-warnings")),
161161
compileDir("tests/neg-custom-args/adhoc-extension", defaultOptions.and("-source", "3.1", "-feature", "-Xfatal-warnings")),
162162
compileFile("tests/neg/i7575.scala", defaultOptions.withoutLanguageFeatures.and("-language:_")),
163163
compileFile("tests/neg-custom-args/kind-projector.scala", defaultOptions.and("-Ykind-projector")),

docs/docs/reference/other-new-features/indentation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Scala 3 enforces some rules on indentation and allows some occurrences of braces
99
- Second, some occurrences of braces `{...}` are made optional. Generally, the rule
1010
is that adding a pair of optional braces will not change the meaning of a well-indented program.
1111

12-
These changes can be turned off with the compiler flag `-noindent`.
12+
These changes can be turned off with the compiler flag `-no-indent`.
1313

1414
### Indentation Rules
1515

@@ -28,7 +28,7 @@ The compiler enforces two rules for well-indented programs, flagging violations
2828
println("done") // error: indented too far to the left
2929
```
3030

31-
2. If significant indentation is turned off (i.e. under Scala 2 mode or under `-noindent`) and we are at the start of an indented sub-part of an expression, and the indented part ends in a newline, the next statement must start at an indentation width less than the sub-part. This prevents errors where an opening brace was forgotten, as in
31+
2. If significant indentation is turned off (i.e. under Scala 2 mode or under `-no-indent`) and we are at the start of an indented sub-part of an expression, and the indented part ends in a newline, the next statement must start at an indentation width less than the sub-part. This prevents errors where an opening brace was forgotten, as in
3232

3333
```scala
3434
if (x < 0)
@@ -379,13 +379,13 @@ end IndentWidth
379379

380380
### Settings and Rewrites
381381

382-
Significant indentation is enabled by default. It can be turned off by giving any of the options `-noindent`, `old-syntax` and `language:Scala2`. If indentation is turned off, it is nevertheless checked that indentation conforms to the logical program structure as defined by braces. If that is not the case, the compiler issues a warning.
382+
Significant indentation is enabled by default. It can be turned off by giving any of the options `-no-indent`, `old-syntax` and `language:Scala2`. If indentation is turned off, it is nevertheless checked that indentation conforms to the logical program structure as defined by braces. If that is not the case, the compiler issues a warning.
383383

384384
The Scala 3 compiler can rewrite source code to indented code and back.
385385
When invoked with options `-rewrite -indent` it will rewrite braces to
386-
indented regions where possible. When invoked with options `-rewrite -noindent` it will rewrite in the reverse direction, inserting braces for indentation regions.
386+
indented regions where possible. When invoked with options `-rewrite -no-indent` it will rewrite in the reverse direction, inserting braces for indentation regions.
387387
The `-indent` option only works on [new-style syntax](./control-syntax.md). So to go from old-style syntax to new-style indented code one has to invoke the compiler twice, first with options `-rewrite -new-syntax`, then again with options
388-
`-rewrite -indent`. To go in the opposite direction, from indented code to old-style syntax, it's `-rewrite -noindent`, followed by `-rewrite -old-syntax`.
388+
`-rewrite -indent`. To go in the opposite direction, from indented code to old-style syntax, it's `-rewrite -no-indent`, followed by `-rewrite -old-syntax`.
389389

390390
### Variant: Indentation Marker `:`
391391

tests/pos/syntax-rewrite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test source should be invariant under the following 4 compilation steps with options
22
// -rewrite -new-syntax
33
// -rewrite -indent
4-
// -rewrite -noindent
4+
// -rewrite -no-indent
55
// -rewrite -old-syntax
66
object test {
77

0 commit comments

Comments
 (0)