diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-19 18:30:58 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-19 18:31:18 +0200 |
commit | 76a056f5e1ea01b3cfdc8832e2a164562da770ab (patch) | |
tree | 81b20e1e067ca3d0cd3bfde5924903b180cf7cc4 /src/dotty/tools/dotc/typer/Implicits.scala | |
parent | c54debead6d12527469b9d69f4ab0d54cc13f7e9 (diff) | |
download | dotty-76a056f5e1ea01b3cfdc8832e2a164562da770ab.tar.gz dotty-76a056f5e1ea01b3cfdc8832e2a164562da770ab.tar.bz2 dotty-76a056f5e1ea01b3cfdc8832e2a164562da770ab.zip |
Refactor viewExists
Factor out isValueSubClass into separate method. Will probably come in handly
elsewhere, and makes the code easier to understand.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 841390ef1..43d93b2b8 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -382,21 +382,10 @@ trait Implicits { self: Typer => && !to.isError && !ctx.isAfterTyper && (ctx.mode is Mode.ImplicitsEnabled) - && { from.widenExpr match { - case from: TypeRef if defn.ScalaValueClasses contains from.symbol => - to.widenExpr match { - case to: TypeRef if defn.ScalaValueClasses contains to.symbol => - util.Stats.record("isValueSubClass") - return defn.isValueSubClass(from.symbol, to.symbol) - case _ => - } - case from: ValueType => - ; - case _ => - return false - } - inferView(dummyTreeOfType(from), to)(ctx.fresh.setExploreTyperState).isInstanceOf[SearchSuccess] - } + && from.isInstanceOf[ValueType] + && ( from.isValueSubType(to) + || inferView(dummyTreeOfType(from), to)(ctx.fresh.setExploreTyperState).isInstanceOf[SearchSuccess] + ) ) /** Find an implicit conversion to apply to given tree `from` so that the |