diff options
author | Martin Odersky <odersky@gmail.com> | 2017-03-08 11:44:45 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-03-08 17:50:20 +0100 |
commit | 7b5cdbc77b5b3e91a90c21a1ed69bc51355243c8 (patch) | |
tree | b51687ec986085a6c1324282f50f55a88f7c3c30 /compiler/src/dotty/tools/dotc/typer/Implicits.scala | |
parent | f07697b25294eaafb1c86698c44a699ec1c0d1ba (diff) | |
download | dotty-7b5cdbc77b5b3e91a90c21a1ed69bc51355243c8.tar.gz dotty-7b5cdbc77b5b3e91a90c21a1ed69bc51355243c8.tar.bz2 dotty-7b5cdbc77b5b3e91a90c21a1ed69bc51355243c8.zip |
Keep old behavior under -language:Scala2
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 { |