diff options
author | Martin Odersky <odersky@gmail.com> | 2014-02-02 18:55:47 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-02-02 18:56:47 +0100 |
commit | 4886d7cb538f9a073827c78671d1890be787c0a5 (patch) | |
tree | 654c02b484be36b885d27677f7ca9328912d5087 /src/dotty/tools/dotc/typer/Typer.scala | |
parent | 19c8cb1bca7a07395446a0cceaab137e5af2c8c5 (diff) | |
download | dotty-4886d7cb538f9a073827c78671d1890be787c0a5.tar.gz dotty-4886d7cb538f9a073827c78671d1890be787c0a5.tar.bz2 dotty-4886d7cb538f9a073827c78671d1890be787c0a5.zip |
Relaxing check that implicits must have explicit return type
Now this is required only for members of a template. Local statements can still have implicits with no result type. (Maybe we need to get back on this).
Also, changed Dotty itself and tests to adhere to the new restriction.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 58522ddb3..8498e5e54 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -862,7 +862,7 @@ class Typer extends Namer with Applications with Implicits { val ValDef(mods, name, tpt, rhs) = vdef val mods1 = typedModifiers(mods) val tpt1 = typedType(tpt) - if (sym is Implicit) checkImplicitTptNonEmpty(vdef) + 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) @@ -877,7 +877,7 @@ class Typer extends Namer with Applications with Implicits { val tparams1 = tparams mapconserve (typed(_).asInstanceOf[TypeDef]) val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf[ValDef]) if (sym is Implicit) { - checkImplicitTptNonEmpty(ddef) + if (sym.owner.isType) checkImplicitTptNonEmpty(ddef) checkImplicitParamsNotSingletons(vparamss1) } val tpt1 = typedType(tpt) |