File tree Expand file tree Collapse file tree 5 files changed +23
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -1359,7 +1359,10 @@ object Scanners {
1359
1359
1360
1360
case class InBraces (var width : IndentWidth | Null , outer : Region )
1361
1361
extends IndentSignificantRegion {
1362
- override def indentWidth = width
1362
+ // The indent width starts out as `null` when the opening brace is encountered
1363
+ // It is then adjusted when the next token on a new line is encountered.
1364
+ override def indentWidth : IndentWidth =
1365
+ if width == null then IndentWidth .Zero else width
1363
1366
}
1364
1367
1365
1368
/** A class describing an indentation region.
Original file line number Diff line number Diff line change @@ -77,8 +77,11 @@ class TreeChecker extends Phase with SymTransformer {
77
77
testDuplicate(sym, seenClasses, " class" )
78
78
}
79
79
80
- val isDeferredAndPrivate = sym.is(Method ) && sym.is(Deferred ) && sym.is(Private )
81
- assert(! isDeferredAndPrivate, i " $sym is both Deferred and Private " )
80
+ val badDeferredAndPrivate =
81
+ sym.is(Method ) && sym.is(Deferred ) && sym.is(Private )
82
+ && ! sym.hasAnnotation(defn.NativeAnnot )
83
+ && ! sym.is(Erased )
84
+ assert(! badDeferredAndPrivate, i " $sym is both Deferred and Private " )
82
85
83
86
checkCompanion(symd)
84
87
Original file line number Diff line number Diff line change
1
+ object A {
2
+ for // error // error
3
+ }
Original file line number Diff line number Diff line change
1
+ class A { if 0 // error
2
+ } // error
Original file line number Diff line number Diff line change
1
+ class A1 {
2
+ @ native private def a : Unit
3
+ }
4
+ trait A2 {
5
+ erased def i (a : Int ): Int
6
+ }
7
+ trait A3 {
8
+ erased val a : Int
9
+ }
You can’t perform that action at this time.
0 commit comments