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

Optimiser disagrees with compiler over what syntax is valid #5322

Closed
scabug opened this issue Dec 16, 2011 · 6 comments
Closed

Optimiser disagrees with compiler over what syntax is valid #5322

scabug opened this issue Dec 16, 2011 · 6 comments
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Dec 16, 2011


import java.io.{File}
abstract sealed trait Path {
val path: String
val name: String
}
case class ExternalPath(path: String) extends File(path) with Path {
override lazy val name: String = getName
}

$ scalac -version
Scala compiler version 2.10.0.dev-1302-g6a33a20 -- Copyright 2002-2011, LAMP/EPFL

$ scala z.scala
$

$ scala -optimize z.scala
/tmp/z.scala:6: error: overriding value path in trait Path of type String;
variable path in class File of type String has weaker access privileges; it should not be private
case class ExternalPath(path: String) extends File(path) with Path {
^
one error found
$

@scabug
Copy link
Author

@scabug scabug commented Dec 16, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5322?orig=1
Reporter: Alan Burlison (alanbur)
Affected Versions: 2.10.0

@scabug
Copy link
Author

@scabug scabug commented Dec 16, 2011

@paulp said:
This is another case of java private fields polluting subclasses. (It's specific to the use of "path", which is a File private.)

See also #3160, #4762, and some others I can't find.

@scabug
Copy link
Author

@scabug scabug commented Jan 22, 2013

@richdougherty said:
I see this error when compiling Akka with -optimize (which we don't usually do).

[error] /p/akka/g/akka-actor/src/main/scala/akka/dispatch/Mailbox.scala:540: overriding method queue in trait QueueBasedMessageQueue of type => java.util.Queue[akka.dispatch.Envelope];
[error]  variable queue in class PriorityBlockingQueue of type Array[Object] has weaker access privileges; it should not be private
[error]     new PriorityBlockingQueue[Envelope](initialCapacity, cmp) with QueueBasedMessageQueue with UnboundedMessageQueueSemantics {
[error]         ^
[warn] 6 warnings found
[error] one error found
@scabug
Copy link
Author

@scabug scabug commented Jun 9, 2013

@magarciaEPFL said:
The new optimizer , http://magarciaepfl.github.io/scala/ , isn't prone to this bug. Just checked.

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@SethTisue SethTisue removed the critical label Jul 27, 2017
@SethTisue
Copy link
Member

@SethTisue SethTisue commented Feb 17, 2018

someone want to check if this is still a bug in 2.12? closing on the suspicion it probably isn't

@SethTisue SethTisue closed this Feb 17, 2018
@martijnhoekstra
Copy link

@martijnhoekstra martijnhoekstra commented Feb 17, 2018

Confirmed can't reproduce

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.