@@ -15,6 +15,7 @@ import TreeInfo._
1515import ProtoTypes ._
1616import Scopes ._
1717import CheckRealizable ._
18+ import NullOpsDecorator ._
1819import ErrorReporting .errorTree
1920import rewrites .Rewrites .patch
2021import util .Spans .Span
@@ -776,17 +777,18 @@ trait Checking {
776777 * - it is defined in Predef
777778 * - it is the scala.reflect.Selectable.reflectiveSelectable conversion
778779 */
779- def checkImplicitConversionUseOK (sym : Symbol , posd : Positioned )(using Context ): Unit =
780+ def checkImplicitConversionUseOK (sym : Symbol , tpe : Type , posd : Positioned )(using Context ): Unit =
780781 if (sym.exists) {
781782 val conv =
782783 if (sym.isOneOf(GivenOrImplicit ) || sym.info.isErroneous) sym
783784 else {
784785 assert(sym.name == nme.apply || ctx.reporter.errorsReported)
785786 sym.owner
786787 }
788+ val tpe1 = if ctx.explicitNulls then tpe.stripNull else tpe
787789 val conversionOK =
788790 conv.is(Synthetic ) ||
789- sym.info.finalResultType .classSymbols.exists(_.isLinkedWith(conv.owner)) ||
791+ tpe1 .classSymbols.exists(_.isLinkedWith(conv.owner)) ||
790792 defn.isPredefClass(conv.owner) ||
791793 conv.name == nme.reflectiveSelectable && conv.maybeOwner.maybeOwner.maybeOwner == defn.ScalaPackageClass
792794 if (! conversionOK)
@@ -1219,7 +1221,7 @@ trait NoChecking extends ReChecking {
12191221 override def checkStable (tp : Type , pos : SourcePosition , kind : String )(using Context ): Unit = ()
12201222 override def checkClassType (tp : Type , pos : SourcePosition , traitReq : Boolean , stablePrefixReq : Boolean )(using Context ): Type = tp
12211223 override def checkImplicitConversionDefOK (sym : Symbol )(using Context ): Unit = ()
1222- override def checkImplicitConversionUseOK (sym : Symbol , posd : Positioned )(using Context ): Unit = ()
1224+ override def checkImplicitConversionUseOK (sym : Symbol , tpe : Type , posd : Positioned )(using Context ): Unit = ()
12231225 override def checkFeasibleParent (tp : Type , pos : SourcePosition , where : => String = " " )(using Context ): Type = tp
12241226 override def checkInlineConformant (tpt : Tree , tree : Tree , sym : Symbol )(using Context ): Unit = ()
12251227 override def checkNoAlphaConflict (stats : List [Tree ])(using Context ): Unit = ()
0 commit comments