File tree 5 files changed +35
-9
lines changed
compiler/src/dotty/tools/dotc
presentation-compiler/src/main/dotty/tools/pc
5 files changed +35
-9
lines changed Original file line number Diff line number Diff line change @@ -1005,16 +1005,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
1005
1005
! tree.symbol.exists
1006
1006
&& tree.isTerm
1007
1007
&& hasRefinement(tree.qualifier.tpe)
1008
- def loop (tree : Tree ): Boolean = tree match
1009
- case TypeApply (fun, _) =>
1010
- loop(fun)
1011
- case Apply (fun, _) =>
1012
- loop(fun)
1008
+ funPart(tree) match
1013
1009
case tree : Select =>
1014
1010
isStructuralTermSelect(tree)
1015
1011
case _ =>
1016
1012
false
1017
- loop(tree)
1018
1013
}
1019
1014
1020
1015
/** Return a pair consisting of (supercall, rest)
Original file line number Diff line number Diff line change @@ -235,14 +235,14 @@ trait Dynamic {
235
235
if ValueClasses .isDerivedValueClass(tpe.classSymbol) && qual.tpe <:< defn.ReflectSelectableTypeRef then
236
236
val genericUnderlying = ValueClasses .valueClassUnbox(tpe.classSymbol.asClass)
237
237
val underlying = tpe.select(genericUnderlying).widen.resultType
238
- New (tpe, tree.cast(underlying) :: Nil )
238
+ New (tpe.widen , tree.cast(underlying) :: Nil )
239
239
else
240
240
tree
241
241
maybeBoxed.cast(tpe)
242
242
243
243
fun.tpe.widen match {
244
244
case tpe : ValueType =>
245
- structuralCall(nme.selectDynamic, Nil ).maybeBoxingCast(tpe)
245
+ structuralCall(nme.selectDynamic, Nil ).maybeBoxingCast(fun. tpe.widenExpr )
246
246
247
247
case tpe : MethodType =>
248
248
def isDependentMethod (tpe : Type ): Boolean = tpe match {
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ object HoverProvider:
181
181
findRefinement(parent)
182
182
case _ => None
183
183
184
- val refTpe = sel.tpe.metalsDealias match
184
+ val refTpe = sel.tpe.widen. metalsDealias match
185
185
case r : RefinedType => Some (r)
186
186
case t : (TermRef | TypeProxy ) => Some (t.termSymbol.info.metalsDealias)
187
187
case _ => None
Original file line number Diff line number Diff line change
1
+ sealed trait Scope
2
+ sealed trait Domain extends Scope
3
+ object Domain extends Domain
4
+
5
+ trait Baz [T ]
6
+ def baz (using ck : Scope ): Baz [ck.type ] = ???
7
+
8
+ class Foo extends scala.reflect.Selectable :
9
+ type TScope = Domain
10
+ final protected given TScope = Domain
11
+
12
+ object ID :
13
+ val internal1 = new Foo :
14
+ val ii = new Foo :
15
+ val x = baz
16
+ val z = internal1.ii.x // error
Original file line number Diff line number Diff line change
1
+ final class Bar
2
+ final class Inv [T ]
3
+ class Foo extends scala.reflect.Selectable :
4
+ type Boo = Bar
5
+ final given boo1 : Boo = new Bar
6
+
7
+ class Test :
8
+ def mkInv (using bar : Bar ): Inv [bar.type ] = new Inv ()
9
+
10
+ def test : Unit =
11
+ val foo1 /* : Foo { val foo2: { z1 => Foo { val inv1: Inv[(z1.boo1 : z1.Boo)] }}} */ = new Foo :
12
+ val foo2 /* : { z1 => Foo { val inv1: Inv[(z1.boo1 : z1.Boo)] }} */ = new Foo :
13
+ val inv1 /* : Inv[( boo1 : Boo)] */ = mkInv /* (this.boo1) */
14
+ val inv2 = foo1.foo2.inv1 // error
15
+ ()
You can’t perform that action at this time.
0 commit comments