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
TraversableLike stringPrefix broken for inner classes #9019
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9019?orig=1 |
@kanielc said: There also seems to be a definite bug in the REPL, as empty string is just illogical here. |
@kanielc said (edited on Dec 6, 2014 4:39:05 AM UTC): The stringPrefix returns the first top-level object within the package. That means it gives no meaningful information for nested constructs. The REPL uses some interesting naming constructs scala> b.getClass.getName.toCharArray
res16: Array[Char] = Array($, l, i, n, e, 3, ., $, r, e, a, d, $, $, i, w, $, $, i, w, $, B, a, r) So due to pinching the text between the last '.' and the first '$' after we end up with "" because we have .$ in the internal representation. |
@kanielc said: Your call :) |
@Ichoran said: |
@Ichoran said: |
@szeiger said: |
For inner classes extending TraversableLike, stringPrefix returns the name of the surrounding object or class.
The expected output would be "Bar" (which you get if Bar is a member of a package) as stated in the docs of TraversableLike:
bq. By default the string prefix is the simple name of the collection class traversable collection.
"Foo.Bar" or "IndexedSeq" would also be reasonable results, but "Foo" is obviously wrong.
Also of note: If you paste the code into the REPL, the actual result is the empty string (because the code is defined in another surrounding object, I guess).
This issue is not specific to the 2.11.4 release, but is present in previous versions, too.
The text was updated successfully, but these errors were encountered: