diff options
author | Martin Odersky <odersky@gmail.com> | 2017-01-30 17:50:08 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-01-31 16:14:18 +1100 |
commit | 801554c386253ad8474babb2d40590c2c8d3a45c (patch) | |
tree | 5c280601f81c1cd4b8c244624b2bf90fecc4337b /compiler | |
parent | 30f3ea1710203b7ccd004bdee414389342d589dc (diff) | |
download | dotty-801554c386253ad8474babb2d40590c2c8d3a45c.tar.gz dotty-801554c386253ad8474babb2d40590c2c8d3a45c.tar.bz2 dotty-801554c386253ad8474babb2d40590c2c8d3a45c.zip |
Allow implicit-by-name parameters
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 8 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Typer.scala | 3 |
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 d05a0aaa7..22a4221ba 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1880,7 +1880,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 |