@@ -602,20 +602,20 @@ object Objects:
602602 case _ => a
603603
604604 def filterType (tpe : Type )(using Context ): Value =
605- val baseClasses = tpe.baseClasses
606- if baseClasses.isEmpty then a
607- else tpe match
605+ tpe match
608606 case t @ SAMType (_, _) if a.isInstanceOf [Fun ] => a // if tpe is SAMType and a is Fun, allow it
609- case _ => filterClass(baseClasses.head) // could have called ClassSymbol, but it does not handle OrType and AndType
607+ case _ =>
608+ val baseClasses = tpe.baseClasses
609+ if baseClasses.isEmpty then a
610+ else filterClass(baseClasses.head) // could have called ClassSymbol, but it does not handle OrType and AndType
610611
611612 def filterClass (sym : Symbol )(using Context ): Value =
612613 if ! sym.isClass then a
613614 else
614615 val klass = sym.asClass
615616 a match
616617 case Cold => Cold
617- case ref : Ref if ref.klass.isSubClass(klass) => ref
618- case ref : Ref => Bottom
618+ case ref : Ref => if ref.klass.isSubClass(klass) then ref else Bottom
619619 case ValueSet (values) => values.map(v => v.filterClass(klass)).join
620620 case arr : OfArray => if defn.ArrayClass .isSubClass(klass) then arr else Bottom
621621 case fun : Fun =>
@@ -1572,7 +1572,7 @@ object Objects:
15721572 report.warning(" The argument should be a constant integer value" , arg)
15731573 res.widen(1 )
15741574 case _ =>
1575- if res.isInstanceOf [Fun ] then res.widen(2 ) else res.widen(1 ) // TODO: changing to widen(2) causes standard library analysis to loop infinitely
1575+ if res.isInstanceOf [Fun ] then res.widen(2 ) else res.widen(1 )
15761576
15771577 argInfos += ArgInfo (widened, trace.add(arg.tree), arg.tree)
15781578 }
0 commit comments