File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -779,14 +779,15 @@ trait Implicits:
779779 */
780780 def inferView (from : Tree , to : Type )(using Context ): SearchResult = {
781781 record(" inferView" )
782+ val wfromtp = from.tpe.widen
782783 if to.isAny
783784 || to.isAnyRef
784785 || to.isRef(defn.UnitClass )
785- || from.tpe .isRef(defn.NothingClass )
786- || from.tpe .isRef(defn.NullClass )
786+ || wfromtp .isRef(defn.NothingClass )
787+ || wfromtp .isRef(defn.NullClass )
787788 || ! ctx.mode.is(Mode .ImplicitsEnabled )
788789 || from.isInstanceOf [Super ]
789- || (from.tpe eq NoPrefix )
790+ || (wfromtp eq NoPrefix )
790791 then NoMatchingImplicitsFailure
791792 else {
792793 def adjust (to : Type ) = to.stripTypeVar.widenExpr match {
Original file line number Diff line number Diff line change 1+ val myNull : Null = null
2+
3+ val n1 : Int = null // error
4+ val n2 : Int = myNull // error
5+
6+ val b1 : Boolean = null // error
7+ val b2 : Boolean = myNull // error
8+
9+ val v1 : AnyVal = null // error
10+ val v2 : AnyVal = myNull // error
You can’t perform that action at this time.
0 commit comments