File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,19 @@ trait TypeAssigner {
53
53
def addRefinement (parent : Type , decl : Symbol ) = {
54
54
val inherited =
55
55
parentType.findMember(decl.name, cls.thisType,
56
- required = EmptyFlags , excluded = Private )
57
- .suchThat(decl.matches(_))
56
+ required = EmptyFlags , excluded = Private
57
+ ) .suchThat(decl.matches(_))
58
58
val inheritedInfo = inherited.info
59
59
val isPolyFunctionApply = decl.name == nme.apply && (parent <:< defn.PolyFunctionType )
60
- if (isPolyFunctionApply || inheritedInfo.exists &&
61
- decl.info.widenExpr <:< inheritedInfo.widenExpr &&
62
- ! (inheritedInfo.widenExpr <:< decl.info.widenExpr)) {
60
+ if isPolyFunctionApply
61
+ || inheritedInfo.exists
62
+ && ! decl.isClass
63
+ && decl.info.widenExpr <:< inheritedInfo.widenExpr
64
+ && ! (inheritedInfo.widenExpr <:< decl.info.widenExpr)
65
+ then
63
66
val r = RefinedType (parent, decl.name, decl.info)
64
67
typr.println(i " add ref $parent $decl --> " + r)
65
68
r
66
- }
67
69
else
68
70
parent
69
71
}
Original file line number Diff line number Diff line change
1
+ trait ZSink {
2
+
3
+ type State
4
+
5
+ def foo : ZSink =
6
+ class Anon extends ZSink {
7
+ case class State (x : Int )
8
+ }
9
+ new Anon
10
+
11
+ def foo2 : ZSink =
12
+ new ZSink {
13
+ case class State (x : Int )
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments