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 {
5353 def addRefinement (parent : Type , decl : Symbol ) = {
5454 val inherited =
5555 parentType.findMember(decl.name, cls.thisType,
56- required = EmptyFlags , excluded = Private )
57- .suchThat(decl.matches(_))
56+ required = EmptyFlags , excluded = Private
57+ ) .suchThat(decl.matches(_))
5858 val inheritedInfo = inherited.info
5959 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
6366 val r = RefinedType (parent, decl.name, decl.info)
6467 typr.println(i " add ref $parent $decl --> " + r)
6568 r
66- }
6769 else
6870 parent
6971 }
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