aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-12-12 09:42:29 +0100
committerMartin Odersky <odersky@gmail.com>2016-12-12 09:42:29 +0100
commit1c03d45b1649bb8307c09ebfd2bcb3b9efe50dad (patch)
tree589cd0abd8272b2340965b70c4e17c0ed45b4b51 /compiler/src/dotty/tools/dotc/typer/Namer.scala
parent740ccf85dbb67e01b9ff27f26542ecf95e874a13 (diff)
downloaddotty-1c03d45b1649bb8307c09ebfd2bcb3b9efe50dad.tar.gz
dotty-1c03d45b1649bb8307c09ebfd2bcb3b9efe50dad.tar.bz2
dotty-1c03d45b1649bb8307c09ebfd2bcb3b9efe50dad.zip
Fix #1784: allow to omit types for local implicit vals
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Namer.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index b8fe46745..e02e90df1 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -998,11 +998,17 @@ class Namer { typer: Typer =>
lhsType // keep constant types that fill in for a non-constant (to be revised when inline has landed).
else inherited
else {
- if (sym is Implicit) {
- val resStr = if (mdef.isInstanceOf[DefDef]) "result " else ""
- ctx.error(s"${resStr}type of implicit definition needs to be given explicitly", mdef.pos)
+ def missingType(modifier: String) = {
+ ctx.error(s"${modifier}type of implicit definition needs to be given explicitly", mdef.pos)
sym.resetFlag(Implicit)
+
}
+ if (sym is Implicit)
+ mdef match {
+ case _: DefDef => missingType("result")
+ case _: ValDef if sym.owner.isType => missingType("")
+ case _ =>
+ }
lhsType orElse WildcardType
}
}