File tree 2 files changed +21
-1
lines changed
compiler/src/dotty/tools/dotc/typer
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
4568
4568
4569
4569
// convert function literal to SAM closure
4570
4570
tree match {
4571
- case closure (Nil , id @ Ident (nme.ANON_FUN ), _)
4571
+ case blockEndingInClosure (Nil , id @ Ident (nme.ANON_FUN ), _)
4572
4572
if defn.isFunctionNType(wtp) && ! defn.isFunctionNType(pt) =>
4573
4573
pt match {
4574
4574
case SAMType (samMeth, samParent)
@@ -4577,6 +4577,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4577
4577
// but this prevents case blocks from implementing polymorphic partial functions,
4578
4578
// since we do not know the result parameter a priori. Have to wait until the
4579
4579
// 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.
4580
4582
return toSAM(tree, samParent)
4581
4583
case _ =>
4582
4584
}
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