File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
test/dotty/tools/pc/tests/hover Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -224,12 +224,17 @@ object HoverProvider:
224
224
225
225
def extractRefinements (t : Type ): List [Type ] = t match
226
226
case r : RefinedType => List (r)
227
- case t : TypeRef => extractRefinements(t.deepDealiasAndSimplify)
228
- case t : (TermRef | TypeProxy ) => List (t.termSymbol.info.deepDealiasAndSimplify)
227
+ case t : (TypeRef | AppliedType ) =>
228
+ // deepDealiasAndSimplify can succeed with no progress, so we have to avoid infinite loops
229
+ val t1 = t.deepDealiasAndSimplify
230
+ if t1 == t then Nil
231
+ else extractRefinements(t1)
232
+ case t : TermRef => extractRefinements(t.widen)
233
+ case t : TypeProxy => List (t.termSymbol.info.deepDealiasAndSimplify)
229
234
case AndType (l , r) => List (extractRefinements(l), extractRefinements(r)).flatten
230
235
case _ => Nil
231
236
232
- val refTpe : List [Type ] = extractRefinements(sel.typeOpt.widen )
237
+ val refTpe : List [Type ] = extractRefinements(sel.typeOpt)
233
238
234
239
refTpe.flatMap(findRefinement).headOption.asJava
235
240
case _ =>
Original file line number Diff line number Diff line change @@ -913,3 +913,16 @@ class HoverTermSuite extends BaseHoverSuite:
913
913
|""" .stripMargin,
914
914
" val aa: Int" .hover
915
915
)
916
+
917
+ @ Test def `intersection_of_selectable-5` =
918
+ check(
919
+ """ |class Record extends Selectable:
920
+ | def selectDynamic(name: String): Any = ???
921
+ |
922
+ |type AL = List[Int] & Record { val aa: Int }
923
+ |
924
+ |val al: AL = ???.asInstanceOf[ABC]
925
+ |val al_a = al.a@@a
926
+ |""" .stripMargin,
927
+ " val aa: Int" .hover
928
+ )
You can’t perform that action at this time.
0 commit comments