Skip to content

Commit e1360eb

Browse files
committed
Don't suggest imports for conversions from Null or Nothing
nor for conversions to Any, AnyRef, or AnyVal.
1 parent 13c1839 commit e1360eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ object ErrorReporting {
151151
val (found2, expected2) =
152152
if (found1 frozen_<:< expected1) (found, expected) else (found1, expected1)
153153
val postScript1 =
154-
if !postScript.isEmpty then postScript
154+
if !postScript.isEmpty
155+
|| expected.isRef(defn.AnyClass)
156+
|| expected.isRef(defn.AnyValClass)
157+
|| expected.isRef(defn.ObjectClass)
158+
|| defn.isBottomType(found)
159+
then postScript
155160
else ctx.typer.implicitSuggestionsFor(ViewProto(found.widen, expected))
156161
TypeMismatch(found2, expected2, whyNoMatchStr(found, expected), postScript1)
157162
}

0 commit comments

Comments
 (0)