Skip to content

REPL does not print toString of value classes #15493

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

Closed
bishabosha opened this issue Jun 21, 2022 · 2 comments · Fixed by #15545
Closed

REPL does not print toString of value classes #15493

bishabosha opened this issue Jun 21, 2022 · 2 comments · Fixed by #15545
Assignees
Milestone

Comments

@bishabosha
Copy link
Member

bishabosha commented Jun 21, 2022

Compiler version

3.1.3

Minimized code

scala> class UInt(val toInt: Int) extends AnyVal
// defined class UInt

scala> val foo = UInt(23)
val foo: UInt = 23
                                                                                                                                 
scala> foo.toString
val res1: String = UInt@17

Expectation

I expect UInt@17 both times, as is in Scala 2 REPL

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:repl and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 21, 2022
@som-snytt
Copy link
Contributor

I might have expected 23 both times, except 23 is a pun for literal types.

It's also eerie that magic number 17 appears in the result.

@rochala
Copy link
Contributor

rochala commented Jun 28, 2022

@som-snytt 17 is not a magic number. It's hex for 23.

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

Successfully merging a pull request may close this issue.

4 participants