Skip to content

Commit 0611185

Browse files
committed
Always enable fewerBraces
This is intended as a test to see what breaks if we made fewerBraces the standard syntax.
1 parent 8f82a28 commit 0611185

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ object Scanners {
209209
def featureEnabled(name: TermName) = Feature.enabled(name)(using languageImportContext)
210210
def erasedEnabled = featureEnabled(Feature.erasedDefinitions)
211211

212-
private inline val fewerBracesByDefault = false
212+
private inline val fewerBracesByDefault = true
213213
// turn on to study impact on codebase if `fewerBraces` was the default
214214

215215
private var fewerBracesEnabledCache = false

compiler/test/dotty/tools/repl/ReplCompilerTests.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ class ReplCompilerTests extends ReplTest:
356356
|""".stripMargin)
357357
assertEquals("val x: Int = 8", storedOutput().trim)
358358
}
359+
/*
359360
initially {
360361
run("""|import language.experimental.fewerBraces
361362
|import language.experimental.fewerBraces as _
@@ -366,7 +367,7 @@ class ReplCompilerTests extends ReplTest:
366367
|""".stripMargin)
367368
assert("expected error if fewerBraces is unimported",
368369
lines().exists(_.contains("missing arguments for method apply")))
369-
}
370+
}*/
370371

371372
object ReplCompilerTests:
372373

tests/neg/fun-ascription.check

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
-- Error: tests/neg/fun-ascription.scala:2:17 --------------------------------------------------------------------------
1+
-- [E081] Type Error: tests/neg/fun-ascription.scala:2:13 --------------------------------------------------------------
22
2 |val x1 = (f: Int => Int) // error
3-
| ^^^^^^^^^^
4-
| function type in type ascription must be enclosed in parentheses
5-
-- Error: tests/neg/fun-ascription.scala:3:16 --------------------------------------------------------------------------
3+
| ^^^
4+
| Missing parameter type
5+
|
6+
| I could not infer the type of the parameter Int.
7+
-- [E081] Type Error: tests/neg/fun-ascription.scala:3:12 --------------------------------------------------------------
68
3 |val x2 = f: Int => Int // error
7-
| ^
8-
| parentheses are required around the parameter of a lambda
9-
| This construct can be rewritten automatically under -rewrite -source 3.0-migration.
9+
| ^^^
10+
| Missing parameter type
11+
|
12+
| I could not infer the type of the parameter Int.

tests/neg/i4373b.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// ==> 05bef7805687ba94da37177f7568e3ba7da1f91c.scala <==
22
class x0 {
3-
x1:
4-
x0 | _ // error
3+
x1: // error
4+
x0 | _
55
// error

0 commit comments

Comments
 (0)