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

isOverride only returns true if the method is explicitly marked as override #6441

Closed
scabug opened this issue Sep 28, 2012 · 5 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 28, 2012

It seems that Symbol.isOverride is not working properly if the override modifier is not set explicitly.

scala> trait A { val a: Traversable[Int] }
defined trait A

scala> trait B extends A { override val a: List[Int] }
defined trait B

scala> trait C extends A { val a: List[Int] }
defined trait C

scala> typeOf[B].members.last.isOverride
res0: Boolean = true

scala> typeOf[C].members.last.isOverride
res1: Boolean = false

The last instruction is returning false, despite of being overridding the a attribute.

@scabug
Copy link
Author

scabug commented Sep 28, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6441?orig=1
Reporter: Jesús López González (jlg)
Affected Versions: 2.10.0-M7

@scabug
Copy link
Author

scabug commented Sep 28, 2012

@paulp said:
Here's a little comment I've had in the compiler source a long time. The OVERRIDE flag (which is what isOverride checks) only reliably corresponds to the word "override" appearing in source.

    // !!! When if ever will this answer differ from .isOverride?
    // How/where is the OVERRIDE flag managed, as compared to how checks
    // based on type membership will evaluate?
    def isOverridingSymbol = owner.isClass && (
      owner.ancestors exists (cls => matchingSymbol(cls, owner.thisType) != NoSymbol)
    )

@scabug
Copy link
Author

scabug commented Sep 7, 2013

@gkossakowski said:
Fix for this issue didn't make it into 2.11.0-M5. I'm rescheduling it for 2.11.0-M6.

@scabug
Copy link
Author

scabug commented Oct 15, 2013

@gkossakowski said:
Unassigning and rescheduling to M7 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented Feb 1, 2014

@xeno-by said:
scala/scala#3452

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