Skip to content

Commit 1c6ded0

Browse files
committed
Rename the setting -noindent into -no-indent.
This is more consistent with most settings, which have dashes between words. We keep `-noindent` as an alias (abbreviation) not to break existing builds that rely on it.
1 parent ff3637f commit 1c6ded0

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
@@ -93,7 +93,7 @@ class ScalaSettings extends Settings.SettingGroup with CommonScalaSettings {
9393
val newSyntax: Setting[Boolean] = BooleanSetting("-new-syntax", "Require `then` and `do` in control expressions.")
9494
val oldSyntax: Setting[Boolean] = BooleanSetting("-old-syntax", "Require `(...)` around conditions.")
9595
val indent: Setting[Boolean] = BooleanSetting("-indent", "Together with -rewrite, remove {...} syntax when possible due to significant indentation.")
96-
val noindent: Setting[Boolean] = BooleanSetting("-noindent", "Require classical {...} syntax, indentation is not significant.")
96+
val noindent: Setting[Boolean] = BooleanSetting("-no-indent", "Require classical {...} syntax, indentation is not significant.").withAbbreviation("-noindent")
9797
val YindentColons: Setting[Boolean] = BooleanSetting("-Yindent-colons", "Allow colons at ends-of-lines to start indentation blocks.")
9898

9999
/** 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
@@ -156,7 +156,7 @@ class CompilationTests {
156156
compileFile("tests/neg-custom-args/infix.scala", defaultOptions.and("-source", "3.1", "-deprecation", "-Xfatal-warnings")),
157157
compileFile("tests/neg-custom-args/missing-alpha.scala", defaultOptions.and("-Yrequire-targetName", "-Xfatal-warnings")),
158158
compileFile("tests/neg-custom-args/wildcards.scala", defaultOptions.and("-source", "3.1", "-deprecation", "-Xfatal-warnings")),
159-
compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-noindent", "-Xfatal-warnings")),
159+
compileFile("tests/neg-custom-args/indentRight.scala", defaultOptions.and("-no-indent", "-Xfatal-warnings")),
160160
compileFile("tests/neg-custom-args/extmethods-tparams.scala", defaultOptions.and("-deprecation", "-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:_")),

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Optional Braces
55

66
As an experimental feature, Scala 3 enforces some rules on indentation and allows
77
some occurrences of braces `{...}` to be optional.
8-
It can be turned off with the compiler flag `-noindent`.
8+
It can be turned off with the compiler flag `-no-indent`.
99

1010
- First, some badly indented programs are flagged with warnings.
1111
- Second, some occurrences of braces `{...}` are made optional. Generally, the rule
@@ -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)
@@ -349,13 +349,13 @@ end IndentWidth
349349

350350
### Settings and Rewrites
351351

352-
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.
352+
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.
353353

354354
The Dotty compiler can rewrite source code to indented code and back.
355355
When invoked with options `-rewrite -indent` it will rewrite braces to
356-
indented regions where possible. When invoked with options `-rewrite -noindent` it will rewrite in the reverse direction, inserting braces for indentation regions.
356+
indented regions where possible. When invoked with options `-rewrite -no-indent` it will rewrite in the reverse direction, inserting braces for indentation regions.
357357
The `-indent` option only works on [new-style syntax](./control-syntax.html). 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
358-
`-rewrite -indent`. To go in the opposite direction, from indented code to old-style syntax, it's `-rewrite -noindent`, followed by `-rewrite -old-syntax`.
358+
`-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`.
359359

360360
### Variant: Indentation Marker `:`
361361

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)