diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-16 21:58:21 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-16 22:00:40 +0100 |
commit | d00c3f5e7925cd246fb10916f6a2d26111ac2689 (patch) | |
tree | 9935b49e4a907700d951e2d5348c8c4bf8f3c81f | |
parent | 0444bad12f0d8eac886fb39dfab428b1e05fa5fc (diff) | |
download | dotty-d00c3f5e7925cd246fb10916f6a2d26111ac2689.tar.gz dotty-d00c3f5e7925cd246fb10916f6a2d26111ac2689.tar.bz2 dotty-d00c3f5e7925cd246fb10916f6a2d26111ac2689.zip |
Flag multiple overloaded variants with default arguments as an error.
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 196cd8408..e8a2548ae 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -411,6 +411,10 @@ object Inferencing { if (decl is Synthetic) doubleDefError(other, decl) else doubleDefError(decl, other) } + if ((decl is HasDefaultParams) && (other is HasDefaultParams)) { + ctx.error(i"two or more overloaded variants of $decl have default arguments") + decl resetFlag HasDefaultParams + } } seen(decl.name) = decl :: seen(decl.name) } |