Skip to content

Commit 45a9b3c

Browse files
authored
Merge pull request #13640 from dotty-staging/fix-13620
Avoid crash in parser when tree has no position
2 parents 401323c + 4488b5b commit 45a9b3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ object Parsers {
16581658
def fail(): Tree = {
16591659
syntaxError(
16601660
"λ requires a single argument of the form X => ... or (X, Y) => ...",
1661-
Span(t.span.start, in.lastOffset)
1661+
Span(startOffset(t), in.lastOffset)
16621662
)
16631663
AppliedTypeTree(applied, args)
16641664
}
@@ -2111,14 +2111,14 @@ object Parsers {
21112111
/** MatchClause ::= `match' `{' CaseClauses `}'
21122112
*/
21132113
def matchClause(t: Tree): Match =
2114-
atSpan(t.span.start, in.skipToken()) {
2114+
atSpan(startOffset(t), in.skipToken()) {
21152115
Match(t, inBracesOrIndented(caseClauses(() => caseClause())))
21162116
}
21172117

21182118
/** `match' `{' TypeCaseClauses `}'
21192119
*/
21202120
def matchType(t: Tree): MatchTypeTree =
2121-
atSpan(t.span.start, accept(MATCH)) {
2121+
atSpan(startOffset(t), accept(MATCH)) {
21222122
MatchTypeTree(EmptyTree, t, inBracesOrIndented(caseClauses(typeCaseClause)))
21232123
}
21242124

0 commit comments

Comments
 (0)