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 @@ -4569,7 +4569,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
45694569
45704570 // convert function literal to SAM closure
45714571 tree match {
4572- case closure (Nil , id @ Ident (nme.ANON_FUN ), _)
4572+ case blockEndingInClosure (Nil , id @ Ident (nme.ANON_FUN ), _)
45734573 if defn.isFunctionNType(wtp) && ! defn.isFunctionNType(pt) =>
45744574 pt match {
45754575 case SAMType (samMeth, samParent)
@@ -4578,6 +4578,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
45784578 // but this prevents case blocks from implementing polymorphic partial functions,
45794579 // since we do not know the result parameter a priori. Have to wait until the
45804580 // body is typechecked.
4581+ // Note: Need to come back to this when we clean up SAMs/PartialFunctions
4582+ // These conditions would most likely be affected by a precise spec.
45814583 return toSAM(tree, samParent)
45824584 case _ =>
45834585 }
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