Skip to content

Commit ce9fc65

Browse files
committed
Keep old behavior under -language:Scala2
1 parent 510c700 commit ce9fc65

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,14 @@ object Implicits {
107107
// emulate the existence of a such a conversion directly in the search.
108108
// The reason for leaving out `Predef_conforms` is that we know it adds
109109
// nothing since it only relates subtype with supertype.
110-
!tpw.isRef(defn.FunctionClass(1)) &&
111-
(!tpw.derivesFrom(defn.Predef_Conforms) || ref.symbol == defn.Predef_conforms)
110+
//
111+
// We keep the old behavior under -language:Scala2.
112+
val isFunction =
113+
if (ctx.scala2Mode) tpw.derivesFrom(defn.FunctionClass(1))
114+
else tpw.isRef(defn.FunctionClass(1))
115+
val isConforms =
116+
tpw.derivesFrom(defn.Predef_Conforms) || ref.symbol == defn.Predef_conforms
117+
!(isFunction || isConforms)
112118
}
113119

114120
def discardForValueType(tpw: Type): Boolean = tpw match {

0 commit comments

Comments
 (0)