@@ -1315,7 +1315,7 @@ object Types {
13151315 * and going to the operands of & and |.
13161316 * Overridden and cached in OrType.
13171317 */
1318- def widenSingletons (using Context ): Type = dealias match {
1318+ def widenSingletons (using Context ): Type = dealiasKeepOpaques match {
13191319 case tp : SingletonType =>
13201320 tp.widen
13211321 case tp : OrType =>
@@ -4535,25 +4535,26 @@ object Types {
45354535 private var cachedPrecise : Option [Boolean ] = None
45364536 protected [Types ] def setPreciseSubstitute (p : Boolean ): Unit = preciseSubstitute = p
45374537 override def isPrecise (using Context ): Boolean =
4538- // the param is substituting a precise type or upper-bounded by a precise type or...
4539- preciseSubstitute || ctx.typerState.constraint.upper(this ).exists(_.isPrecise) ||
4540- cachedPrecise.getOrElse {
4541- val precise =
4542- // the param itself is annotated as precise or the param is first introduced
4543- // in a precise position of an applied type argument
4544- binder.paramPrecises(paramNum) || binder.resType.paramInfoss.view.flatten.map(_.dealias).flatMap {
4545- case p : TypeParamRef if p == this => Some (false )
4546- case AppliedType (tycon, args) =>
4547- val paramIdx = args.indexOf(this )
4548- val syms = tycon.typeParamSymbols
4549- if syms.isEmpty then None
4550- else if paramIdx >= 0 then Some (syms(paramIdx).paramPrecise)
4551- else None
4552- case _ => None
4553- }.headOption.getOrElse(false )
4554- cachedPrecise = Some (precise)
4555- precise
4556- }
4538+ // the param is substituting a precise type or...
4539+ preciseSubstitute || cachedPrecise.getOrElse {
4540+ val precise =
4541+ // the param itself is annotated as precise or the param is first introduced
4542+ // in a precise position of an applied type argument
4543+ binder.paramPrecises(paramNum) || binder.resType.paramInfoss.view.flatten.flatMap {
4544+ case p : TypeParamRef if p == this => Some (false )
4545+ case at @ AppliedType (_, args) =>
4546+ val paramIdx = args.indexOf(this )
4547+ val syms = at.tyconTypeParams
4548+ if syms.isEmpty then None
4549+ else if paramIdx >= 0 then Some (syms(paramIdx).paramPrecise)
4550+ else None
4551+ case _ => None
4552+ }.headOption.getOrElse(false )
4553+ cachedPrecise = Some (precise)
4554+ precise
4555+ } ||
4556+ // the param upper-bounded by a precise type
4557+ ctx.typerState.constraint.upper(this ).filter(_.paramName != this .paramName).exists(_.isPrecise)
45574558
45584559 /** Optimized version of occursIn, avoid quadratic blowup when solving
45594560 * constraints over large ground types.
0 commit comments