Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression in trait superaccessors with overloading #8010

Closed
scabug opened this issue Nov 25, 2013 · 8 comments
Closed

regression in trait superaccessors with overloading #8010

scabug opened this issue Nov 25, 2013 · 8 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Nov 25, 2013

trait Base {
  def t          = 0
  def t(n: Int)  = 0
  def bt         = 0
  def bt(n: Int) = 0
}
trait Derived extends Base {
  override def t          = super.t
  override def t(n: Int)  = super.t(n)
  override def bt         = super.bt
  override def bt(n: Int) = super.bt(n)
}
sandbox/test.scala:11: error: double definition:
def super$bt(n: Int): Int at line 11 and
def super$bt(n: Int): Int at line 11
have same type
  override def bt(n: Int) = super.bt(n)
                                  ^
sandbox/test.scala:9: error: double definition:
def super$t(n: Int): Int at line 9 and
def super$t(n: Int): Int at line 9
have same type
  override def t(n: Int)  = super.t(n)
                                  ^
two errors found

As seen in Spec2.

@scabug
Copy link
Author

scabug commented Nov 25, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8010?orig=1
Reporter: @retronym
Affected Versions: 2.11.0-M6
Other Milestones: 2.11.0-M8
See #7776

@scabug
Copy link
Author

scabug commented Nov 25, 2013

@retronym said:
Regressed in 086702d8a74d6642622c6b5bb3524bd6d9abbf7e (#7776 post-erasure signature clashes are now macro-aware). /cc @xeno-by

@scabug
Copy link
Author

scabug commented Nov 25, 2013

@retronym said:
Wow, this fixes it

-sameTypeAfterErasure(e.sym, e1.sym)
+sameTypeAfterErasure(e1.sym, e.sym)

I'll find out why and submit a patch.

@scabug
Copy link
Author

scabug commented Nov 25, 2013

@adriaanm said:
in the mean time i'm nominating you for bizarro bug find of the month

@scabug
Copy link
Author

scabug commented Nov 25, 2013

@retronym said:

-sameTypeAfterErasure(def bt(): Int, def bt(n: Int): Int): false
-sameTypeAfterErasure(def t(): Int, def t(n: Int): Int): false
+sameTypeAfterErasure(def bt(n: Int): Int, def bt(): Int): false
+sameTypeAfterErasure(def t(n: Int): Int, def t(): Int): false
 sameTypeAfterErasure(def t(): Int, def t(n: Int): Int): false
 sameTypeAfterErasure(def bt(): Int, def bt(n: Int): Int): false
-sameTypeAfterErasure(final def super$bt(): Int, final def super$bt(n: Int): Int): false
-sameTypeAfterErasure(final def super$t(): Int, final def super$t(n: Int): Int): false
-sameTypeAfterErasure(override def bt(): Int, override def bt(n: Int): Int): false
-sameTypeAfterErasure(override def t(): Int, override def t(n: Int): Int): false
+sameTypeAfterErasure(final def super$bt(n: Int): Int, final def super$bt(): Int): false
+sameTypeAfterErasure(final def super$bt(n: Int): Int, final def super$bt(n: Int): Int): true
+test/files/run/t8010.scala:12: error: double definition:
+def super$bt(n: Int): Int at line 12 and
+def super$bt(n: Int): Int at line 12
+have same type
+  override def bt(n: Int) = 1 + super.bt(n)
+                                      ^
+sameTypeAfterErasure(final def super$bt(): Int, final def super$bt: <error>): true
+sameTypeAfterErasure(final def super$t(n: Int): Int, final def super$t(): Int): false
+sameTypeAfterErasure(final def super$t(n: Int): Int, final def super$t(n: Int): Int): true
+test/files/run/t8010.scala:10: error: double definition:
+def super$t(n: Int): Int at line 10 and
+def super$t(n: Int): Int at line 10
+have same type
+  override def t(n: Int)  = 1 + super.t(n)
+                                      ^
+sameTypeAfterErasure(final def super$t(): Int, final def super$t: <error>): true
+sameTypeAfterErasure(override def bt(n: Int): Int, override def bt(): Int): false
+sameTypeAfterErasure(override def t(n: Int): Int, override def t(): Int): false
 sameTypeAfterErasure(override def t(): Int, override def t(n: Int): Int): false
 sameTypeAfterErasure(override def t(): Int, def t(n: Int): Int): false
 sameTypeAfterErasure(override def bt(): Int, override def bt(n: Int): Int): false

@scabug
Copy link
Author

scabug commented Nov 26, 2013

@retronym said:
Corrupt Scope? Request for Elucidation: https://groups.google.com/d/msg/scala-internals/TS_KSpsLa4g/0juGQy0nAwwJ

@scabug
Copy link
Author

scabug commented Dec 4, 2013

@retronym said:
Adding fix-by 2.10.4 as the change that caused the regression was backported to 2.10.x

@scabug
Copy link
Author

scabug commented Dec 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants