diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-21 14:42:02 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-21 14:42:02 +0200 |
commit | 1ed37543f0dc893ba697c212c310063541018f5c (patch) | |
tree | c0e76ae1e556ad40bb3e6c3ff6aef90b2ce342ef /src/dotty/tools/dotc/typer/Implicits.scala | |
parent | 7e1bd23bf01c6949e08785eb5afc0fcf46b72afb (diff) | |
download | dotty-1ed37543f0dc893ba697c212c310063541018f5c.tar.gz dotty-1ed37543f0dc893ba697c212c310063541018f5c.tar.bz2 dotty-1ed37543f0dc893ba697c212c310063541018f5c.zip |
Added code for adapt and more.
- Pushed mode into context
- Elimintaed scope nesting level
- Fixed a desugar bug
- Added constant folding
Diffstat (limited to 'src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index ec2f46d5d..9f7956203 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -8,6 +8,7 @@ import util.Positions._ import Contexts._ import Types._ import Flags._ +import Mode.ImplicitsDisabled import Denotations._ import NameOps._ import SymDenotations._ @@ -27,7 +28,7 @@ object Implicits { /** A common base class of contextual implicits and of-type implicits which * represents as set of implicit references. */ - abstract class ImplicitRefs extends Compatibility with Normalizing { + abstract class ImplicitRefs extends Compatibility { /** The implicit references */ def refs: Set[TermRef] @@ -207,7 +208,7 @@ trait Implicits { self: Typer => def typedImplicit(ref: TermRef)(implicit ctx: Context): SearchResult = { val id = Ident(ref).withPos(pos) val tree = - if (argument.isEmpty) adapt(id, Mode.Expr, pt) + if (argument.isEmpty) adapt(id, pt) else typedApply(id, ref, argument :: Nil, pt) if (tree.tpe.isError) NoImplicitMatches // todo: replace by checking if local errors were reported in ctx. else SearchSuccess(ref, tree, ctx.typerState) @@ -220,7 +221,7 @@ trait Implicits { self: Typer => */ private def rankImplicits(pending: List[TermRef], acc: List[SearchSuccess]): List[SearchSuccess] = pending match { case ref :: pending1 => - typedImplicit(ref)(ctx.fresh.withNewTyperState.silent) match { + typedImplicit(ref)(ctx.fresh.withNewTyperState.addMode(ImplicitsDisabled)) match { case fail: SearchFailure => rankImplicits(pending1, acc) case best @ SearchSuccess(bestRef, _, _) => |