diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-01-17 16:37:24 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-17 16:37:24 +0100 |
commit | ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f (patch) | |
tree | 3f62a3a92102fe9538d558b1ca9722721502714d /test | |
parent | a5b0fc49e517d1c63d22f9909ac9bed0552ed466 (diff) | |
download | scala-ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f.tar.gz scala-ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f.tar.bz2 scala-ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f.zip |
SI-8157 Make overloading, defaults restriction PolyType aware
Named/Default args levies an implementation restriction that
only one overloaded alternative may declare defaults.
But, this restriction failed to consider polymorphic methods.
Rather than matching on MethodType, this commit uses `Type#paramms`,
which handles PolyTypes and curried MethodTypes in one fell swoop.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t8157.check | 4 | ||||
-rw-r--r-- | test/files/neg/t8157.scala | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/test/files/neg/t8157.check b/test/files/neg/t8157.check new file mode 100644 index 0000000000..9a21a49a07 --- /dev/null +++ b/test/files/neg/t8157.check @@ -0,0 +1,4 @@ +t8157.scala:1: error: in object Test, multiple overloaded alternatives of method foo define default arguments. +object Test { + ^ +one error found diff --git a/test/files/neg/t8157.scala b/test/files/neg/t8157.scala new file mode 100644 index 0000000000..462d4fa3f1 --- /dev/null +++ b/test/files/neg/t8157.scala @@ -0,0 +1,4 @@ +object Test { + def foo(printer: Any, question: => String, show: Boolean = false)(op: => Any): Any = ??? + def foo[T](question: => String, show: Boolean)(op: => Any = ()): Any = ??? +} |