aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-05-01 11:30:11 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-05-08 21:51:47 +0200
commit4ae473eff25335d2b6b0f5900eed55ffa5141d2a (patch)
tree6b3a120e9fcc98d45122dbae54a73ccacc1a1ca7 /src/dotty/tools/dotc/typer/Typer.scala
parent620b2f4435249cc651d31dbabcb3c902da3b160c (diff)
downloaddotty-4ae473eff25335d2b6b0f5900eed55ffa5141d2a.tar.gz
dotty-4ae473eff25335d2b6b0f5900eed55ffa5141d2a.tar.bz2
dotty-4ae473eff25335d2b6b0f5900eed55ffa5141d2a.zip
Tightening of rules for explicit types for implicit defs
1) We now demand that all implicit defs have an implicit type, not just class members. If we admitted implicit term members without explicit types, the rules and algorithms for dteremining eligible implicits would be greatly complicated (because there's always the danger that inferring the type by typechecking the rhs causes a cyclic reference). 2) We check for violations of this rule earlier, during type completion, in order to avoid cyclic references happening before we do the check.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index c79ecdf85..f4b52ce09 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -753,7 +753,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
val ValDef(mods, name, tpt, rhs) = vdef
val mods1 = typedModifiers(mods, sym)
val tpt1 = typedType(tpt)
- if ((sym is Implicit) && sym.owner.isType) checkImplicitTptNonEmpty(vdef)
val rhs1 = rhs match {
case Ident(nme.WILDCARD) => rhs withType tpt1.tpe
case _ => typedExpr(rhs, tpt1.tpe)
@@ -766,10 +765,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
val mods1 = typedModifiers(mods, sym)
val tparams1 = tparams mapconserve (typed(_).asInstanceOf[TypeDef])
val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf[ValDef])
- if (sym is Implicit) {
- if (sym.owner.isType) checkImplicitTptNonEmpty(ddef)
- checkImplicitParamsNotSingletons(vparamss1)
- }
+ if (sym is Implicit) checkImplicitParamsNotSingletons(vparamss1)
val tpt1 = typedType(tpt)
val rhs1 = typedExpr(rhs, tpt1.tpe)
assignType(cpy.DefDef(ddef, mods1, name, tparams1, vparamss1, tpt1, rhs1), sym)