File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -4568,7 +4568,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
45684568
45694569 // convert function literal to SAM closure
45704570 tree match {
4571- case closure (Nil , id @ Ident (nme.ANON_FUN ), _)
4571+ case blockEndingInClosure (Nil , id @ Ident (nme.ANON_FUN ), _)
45724572 if defn.isFunctionNType(wtp) && ! defn.isFunctionNType(pt) =>
45734573 pt match {
45744574 case SAMType (samMeth, samParent)
@@ -4577,6 +4577,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
45774577 // but this prevents case blocks from implementing polymorphic partial functions,
45784578 // since we do not know the result parameter a priori. Have to wait until the
45794579 // body is typechecked.
4580+ // Note: Need to come back to this when we clean up SAMs/PartialFunctions
4581+ // These conditions would most likely be affected by a precise spec.
45804582 return toSAM(tree, samParent)
45814583 case _ =>
45824584 }
Original file line number Diff line number Diff line change 1+ def Test =
2+ val members = collection.immutable.SortedSet .empty[String ]
3+ members.collect {
4+ var upNumber = 0
5+ {
6+ case m =>
7+ // upNumber += 1
8+ m
9+ }
10+ }
11+
12+ members.collect {
13+ var upNumber = 0
14+ {
15+ m => m
16+ }
17+ }
18+
You can’t perform that action at this time.
0 commit comments