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
Allow masking of predef implicits (in REPL) #1931
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1931?orig=1 |
@dragos said: import Predef.{any2stringadd => _}
class Foo {
(new Object) + ""
} The output: hiding.scala:4: error: value + is not a member of java.lang.Object
(new Object) + ""
^
one error found |
@dcsobral said: import Predef.{augmentString => _} // This works
object Unimport {
val x = "x" * 5
def main(args: Array[String]) {
import Predef.{augmentString => _} // Here it doesn't work
// import Predef.{wrapString => _} // This line doesn't make any difference,
// here or at the beginning. It looks like a bug.
Console.println("x" * 5)
}
} |
@hubertp said: Closing to the previous state. |
@paulp said: |
@jrudolph said: try to compile this: import Predef.{intWrapper => _}
object Test {
println("test")
} |
@jrudolph said: Now if you use it in other cases, like when you've imported something in an outer scope and want to remove a symbol from inner scopes it doesn't work at all (and this is what this ticket is about) because renaming a thing in an inner scope doesn't remove it from the outer scope and because searches are done from inner to outer scope it is always found nevertheless. I would propose a more general solution: My feeling is that, especially with implicits being bound to scope, finer grained control is needed in some cases. |
@som-snytt said:
|
@som-snytt said: Actually, for that last example, you have to: import Predef.{ augmentString => _, wrapString => _, _ } |
It would be very useful in some instances to be able to do something like "import {Predef.any2StringAdd => _}" to hide predef implicits.
The text was updated successfully, but these errors were encountered: