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