Skip to content

Commit 99d8395

Browse files
committed
Give Closure trees the span of the underling function
1 parent 3475da3 commit 99d8395

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,9 @@ object desugar {
13391339
DefDef(nme.ANON_FUN, params :: Nil, if (tpt == null) TypeTree() else tpt, body)
13401340
.withSpan(span)
13411341
.withMods(synthetic | Artifact),
1342-
Closure(Nil, Ident(nme.ANON_FUN), if (isContextual) ContextualEmptyTree else EmptyTree))
1342+
Closure(Nil, Ident(nme.ANON_FUN), if (isContextual) ContextualEmptyTree else EmptyTree)
1343+
.withSpan(span)
1344+
)
13431345

13441346
/** If `nparams` == 1, expand partial function
13451347
*

tests/neg/i7746.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class A {
2-
def foo = (x : Int, y => x) => () // error // error
2+
def foo = (x : Int, y => x) => () // error: not a gel formal parameter
33
}

tests/neg/i9299.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
type F <: F = 1 match { // error
2-
case _ => foo.foo // error // error
1+
type F <: F = 1 match { // error: Recursion limit exceeded.
2+
case _ => foo.foo // error: Recursion limit exceeded.
33
}
44
def foo(a: Int): Unit = ???

0 commit comments

Comments
 (0)