File tree 3 files changed +26
-0
lines changed
compiler/src/dotty/tools/dotc/ast
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -992,6 +992,8 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
992
992
def hasRefinement (qualtpe : Type ): Boolean = qualtpe.dealias match
993
993
case defn.PolyFunctionOf (_) =>
994
994
false
995
+ case tp : MatchType =>
996
+ hasRefinement(tp.tryNormalize)
995
997
case RefinedType (parent, rname, rinfo) =>
996
998
rname == tree.name || hasRefinement(parent)
997
999
case tp : TypeProxy =>
Original file line number Diff line number Diff line change
1
+ class Ifce [BT <: Boolean ]:
2
+ type RT = BT match
3
+ case true => this .type { val v1 : Int }
4
+ case false => this .type
5
+ def cast : RT = this .asInstanceOf [RT ]
6
+
7
+ class Test :
8
+ def t1 : Unit =
9
+ val full1 = new Ifce [true ]().cast
10
+ val v1 = full1.v1 // error
11
+ // ^^^^^
12
+ // Found: (full1 : Ifce[(true : Boolean)]#RT)
13
+ // Required: Selectable | Dynamic
Original file line number Diff line number Diff line change
1
+ class Ifce [BT <: Boolean ] extends Selectable :
2
+ type RT = BT match
3
+ case true => this .type { val v1 : Int }
4
+ case false => this .type
5
+ def cast : RT = this .asInstanceOf [RT ]
6
+ def selectDynamic (key : String ): Any = ???
7
+
8
+ class Test :
9
+ def t1 : Unit =
10
+ val full = (new Ifce [true ]).cast
11
+ val v1 = full.v1
You can’t perform that action at this time.
0 commit comments