diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-20 10:54:25 +0100 |
---|---|---|
committer | Tobias Schlatter <tobias@meisch.ch> | 2014-03-21 11:28:30 +0100 |
commit | 72a5f392bf11b6474b351cd81a17d0ceeed13dcc (patch) | |
tree | 852be17c2bf42d380eb8078823bca2bfe60b0ccc /tests/pos/overloaded.scala | |
parent | 07939c96715cd5adf7f220d239f61b73dd00edc3 (diff) | |
download | dotty-72a5f392bf11b6474b351cd81a17d0ceeed13dcc.tar.gz dotty-72a5f392bf11b6474b351cd81a17d0ceeed13dcc.tar.bz2 dotty-72a5f392bf11b6474b351cd81a17d0ceeed13dcc.zip |
Reverting decision what constitutes a double def.
test case t0273. Was positive in Scala 2, is now deemed to be negative.
Two two definitions
def a = () => ()
def a[T] = (p:A) => ()
do have matching signatures, so should constitute a double definition.
I previously thought that we can get away if the two definitions have
different result types, but then you immediately have a problem because
the denotations have matching signatures for the pruposes of "&" yet
cannot be merged. Which of the two definitions would override
a definition in a base class is then an arbitrary decision.
Diffstat (limited to 'tests/pos/overloaded.scala')
-rw-r--r-- | tests/pos/overloaded.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/pos/overloaded.scala b/tests/pos/overloaded.scala index ebc1501d8..a26b9b859 100644 --- a/tests/pos/overloaded.scala +++ b/tests/pos/overloaded.scala @@ -2,23 +2,23 @@ object overloaded { def f(x: String): String = x def f[T >: Null](x: T): Int = 1 - + val x1 = f("abc") val x2 = f(new Integer(1)) val x3 = f(null) - + val x4: String => String = f val x5: String => Any = f val x6: Any = f _ - + def g(): Int = 1 def g(x: Int): Int = 2 - + val y1: Int => Int = g - val y2: Any = g _ - + val y2: Any = g _ + println(g) - + val xs = List("a", "b") xs.mkString } |