diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Implicits.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index 933e26564..e1e4a9259 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -107,8 +107,14 @@ object Implicits { // emulate the existence of a such a conversion directly in the search. // The reason for leaving out `Predef_conforms` is that we know it adds // nothing since it only relates subtype with supertype. - !tpw.isRef(defn.FunctionClass(1)) && - (!tpw.derivesFrom(defn.Predef_Conforms) || ref.symbol == defn.Predef_conforms) + // + // We keep the old behavior under -language:Scala2. + val isFunction = + if (ctx.scala2Mode) tpw.derivesFrom(defn.FunctionClass(1)) + else tpw.isRef(defn.FunctionClass(1)) + val isConforms = + tpw.derivesFrom(defn.Predef_Conforms) || ref.symbol == defn.Predef_conforms + !(isFunction || isConforms) } def discardForValueType(tpw: Type): Boolean = tpw match { |