File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -409,7 +409,9 @@ object Parsers {
409
409
false
410
410
}
411
411
412
- def errorTermTree (start : Offset ): Tree = atSpan(Span (start, in.offset)) { unimplementedExpr }
412
+ def errorTermTree (start : Offset ): Tree =
413
+ val end = if in.token == OUTDENT then start else in.offset
414
+ atSpan(Span (start, end)) { unimplementedExpr }
413
415
414
416
private var inFunReturnType = false
415
417
private def fromWithinReturnType [T ](body : => T ): T = {
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ object Scanners {
307
307
println(s " \n START SKIP AT ${sourcePos().line + 1 }, $this in $currentRegion" )
308
308
var noProgress = 0
309
309
// Defensive measure to ensure we always get out of the following while loop
310
- // even if source file is weirly formatted (i.e. we never reach EOF)
310
+ // even if source file is weirdly formatted (i.e. we never reach EOF)
311
311
var prevOffset = offset
312
312
while ! atStop && noProgress < 3 do
313
313
nextToken()
Original file line number Diff line number Diff line change @@ -1339,7 +1339,7 @@ trait Checking {
1339
1339
typr.println(i " check no double declarations $cls" )
1340
1340
1341
1341
def checkDecl (decl : Symbol ): Unit = {
1342
- for ( other <- seen(decl.name) if ! decl.isAbsent() && ! other.isAbsent()) {
1342
+ for other <- seen(decl.name) if decl.name != nme. ERROR && ! decl.isAbsent() && ! other.isAbsent() do
1343
1343
typr.println(i " conflict? $decl $other" )
1344
1344
def javaFieldMethodPair =
1345
1345
decl.is(JavaDefined ) && other.is(JavaDefined ) &&
@@ -1356,7 +1356,6 @@ trait Checking {
1356
1356
if decl.hasDefaultParams && other.hasDefaultParams then
1357
1357
report.error(em " two or more overloaded variants of $decl have default arguments " , decl.srcPos)
1358
1358
decl.resetFlag(HasDefaultParams )
1359
- }
1360
1359
if (! excludeFromDoubleDeclCheck(decl))
1361
1360
seen(decl.name) = decl :: seen(decl.name)
1362
1361
}
Original file line number Diff line number Diff line change
1
+
2
+ trait Collection [Self , Element ]:
3
+ type Index
4
+ extension (self : Self )
5
+ def start : Index
6
+
7
+ sealed trait Tree [+ T ]
8
+ object Tree :
9
+ case object Empty extends Tree [Nothing ]
10
+ case class Node [+ T ](value : T , lhs : Tree [T ], rhs : Tree [T ]) extends Tree [T ]
11
+
12
+ enum Direction :
13
+ case Left , Right , Here
14
+ given [T ]: Collection [Tree [T ], T ] with
15
+ type Index = List [Direction ]
16
+ extension (self : Tree [T ])
17
+ def start : List [Direction ] = match self // error syntax
18
+ case Empty => Nil // error poor recovery
19
+ case Node (_, l, _) => l.start :+ Left // error poor recovery
You can’t perform that action at this time.
0 commit comments