Skip to content

Commit 801554c

Browse files
committed
Allow implicit-by-name parameters
1 parent 30f3ea1 commit 801554c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,12 +1765,8 @@ object Parsers {
17651765
TypeTree() // XX-METHOD-INFER
17661766
} else {
17671767
accept(COLON)
1768-
if (in.token == ARROW) {
1769-
if (owner.isTypeName && !(mods is Local))
1770-
syntaxError(s"${if (mods is Mutable) "`var'" else "`val'"} parameters may not be call-by-name")
1771-
else if (imods.hasFlags)
1772-
syntaxError("implicit parameters may not be call-by-name")
1773-
}
1768+
if (in.token == ARROW && owner.isTypeName && !(mods is Local))
1769+
syntaxError(s"${if (mods is Mutable) "`var'" else "`val'"} parameters may not be call-by-name")
17741770
paramType()
17751771
}
17761772
val default =

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
18801880
val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) =>
18811881
def implicitArgError(msg: String => String) =
18821882
errors += (() => msg(em"parameter $pname of $methodStr"))
1883-
inferImplicitArg(formal, implicitArgError, tree.pos.endPos)
1883+
if (errors.nonEmpty) EmptyTree
1884+
else inferImplicitArg(formal.widenExpr, implicitArgError, tree.pos.endPos)
18841885
}
18851886
if (errors.nonEmpty) {
18861887
// If there are several arguments, some arguments might already

0 commit comments

Comments
 (0)