aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-01-30 17:50:08 +1100
committerMartin Odersky <odersky@gmail.com>2017-02-08 19:35:58 +1100
commit4086195fe188804ce5a052d7b3c2aee099c425d1 (patch)
tree6741b4dbbf4c834d0281de0ff6341229b5fb1e9d /compiler/src/dotty
parent971b233bc916ddbb4501f480500f9531fab99f78 (diff)
downloaddotty-4086195fe188804ce5a052d7b3c2aee099c425d1.tar.gz
dotty-4086195fe188804ce5a052d7b3c2aee099c425d1.tar.bz2
dotty-4086195fe188804ce5a052d7b3c2aee099c425d1.zip
Allow implicit-by-name parameters
Diffstat (limited to 'compiler/src/dotty')
-rw-r--r--compiler/src/dotty/tools/dotc/parsing/Parsers.scala8
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala3
2 files changed, 4 insertions, 7 deletions
diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
index f62093db0..a733eb65d 100644
--- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -1765,12 +1765,8 @@ object Parsers {
TypeTree() // XX-METHOD-INFER
} else {
accept(COLON)
- if (in.token == ARROW) {
- if (owner.isTypeName && !(mods is Local))
- syntaxError(s"${if (mods is Mutable) "`var'" else "`val'"} parameters may not be call-by-name")
- else if (imods.hasFlags)
- syntaxError("implicit parameters may not be call-by-name")
- }
+ if (in.token == ARROW && owner.isTypeName && !(mods is Local))
+ syntaxError(s"${if (mods is Mutable) "`var'" else "`val'"} parameters may not be call-by-name")
paramType()
}
val default =
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 59df98a93..18ae790b7 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1879,7 +1879,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) =>
def implicitArgError(msg: String => String) =
errors += (() => msg(em"parameter $pname of $methodStr"))
- inferImplicitArg(formal, implicitArgError, tree.pos.endPos)
+ if (errors.nonEmpty) EmptyTree
+ else inferImplicitArg(formal.widenExpr, implicitArgError, tree.pos.endPos)
}
if (errors.nonEmpty) {
// If there are several arguments, some arguments might already