File tree 2 files changed +20
-1
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ class ExpandSAMs extends MiniPhase {
88
88
cpy.Block (tree)(List (applyDef, isDefinedAtDef), anonCls)
89
89
}
90
90
91
- private def checkRefinements (tpe : Type , pos : Position )(implicit ctx : Context ): Type = tpe match {
91
+ private def checkRefinements (tpe : Type , pos : Position )(implicit ctx : Context ): Type = tpe.dealias match {
92
92
case RefinedType (parent, name, _) =>
93
93
if (name.isTermName && tpe.member(name).symbol.ownersIterator.isEmpty) // if member defined in the refinement
94
94
ctx.error(" Lambda does not define " + name, pos)
Original file line number Diff line number Diff line change
1
+ class Test {
2
+ def test : Unit = {
3
+ val a : PartialFunction [Int , Int ]{ def foo : Int } = { case x => x } // error
4
+
5
+ type PF = PartialFunction [Int , Int ] { def foo : Int }
6
+ val b : PF = { case x => x } // error
7
+
8
+ type PF1 = PartialFunction [Int , Int ] {def foo : Int }
9
+ val c : PF1 {} = { case x => x } // error
10
+
11
+ type PF2 = PartialFunction [Int , Int ]
12
+ val d : PF2 {} = { case x => x }
13
+
14
+ type PF3 = PartialFunction [Int , Int ] {}
15
+ val e : PF3 = { case x => x }
16
+
17
+ val f : PartialFunction [Int , Int ] {} { def foo : Int } = { case x => x } // error
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments