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

The description and method declaration of Any.equals should use the same parameter name in ScalaDoc #6684

Open
scabug opened this issue Nov 18, 2012 · 8 comments

Comments

@scabug
Copy link

scabug commented Nov 18, 2012

The description in the ScalaDoc of Any.eqauls() states:

"Compares the receiver object (this) with the argument object (that) for equivalence."

but the argument name is "arg0". The description and method declaration should be the same.

@scabug
Copy link
Author

scabug commented Nov 18, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6684?orig=1
Reporter: graham seed (gmseed)
Affected Versions: 2.9.2, 2.10.0-M3

@scabug
Copy link
Author

scabug commented May 14, 2013

@soc said:
This is weird, because the parameter names are actually correct when looking at the source file. Maybe there is some library-aux magic happening of which I'm not aware of ...

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@scala scala deleted a comment from scabug Mar 3, 2018
@scala scala deleted a comment from scabug Mar 3, 2018
@SethTisue
Copy link
Member

same in 2.12.4

@mado-m
Copy link

mado-m commented Jun 27, 2019

same in 2.13.0
It is strange.

@nogurenn
Copy link

nogurenn commented Aug 27, 2019

I tried searching the scaladoc website for "equals", and it's dominated by the arg0 parameter. Not a good sight, to be honest.

I thought about the parameter arg0, and I figured to do a quick search online because I think it's being generated by something really implicit. See this (https://stackoverflow.com/questions/18556400/some-function-parameters-named-arg0-arg1-etc-after-compiling-a-jar-library).

I guess the questions I have are: (1) is scaladoc generating the docs based on the compiled classes/files, and (2) is the bootstrapping/compilation process for library-aux explicitly accounting for the automatically generated argN params. I'm also asking about (2) because build.sbt only references library-aux in the variable library, and because the README inside explicitly says files residing there cannot be compiled by normal means.

@Jasper-M
Copy link
Member

Jasper-M commented Aug 28, 2019

Note that at compile time the parameter of equals is called x$1, which is also some default name for parameters whose names are not present in the class file.

What I find the weirdest is that the Scaladoc uses arg0 instead of x$1, which suggests that it doesn't just take the names from the method symbol in the compiler, but it doesn't use the names from the source code either.

@nogurenn
Copy link

@Jasper-M Where should I start looking? I'm definitely a beginner with all the compiler stuff.

@Jasper-M
Copy link
Member

I don't know anything about scaladoc, but the class symbols for Any and AnyRef, and the symbols for their methods are generated programmatically in scala.reflect.internal.Definitions. If you look a bit further you find that it uses the method Symbol#newSyntheticValueParams which explicitly generates those nondescriptive x$1 names. Another difficulty is that some AnyRef method symbols are not generated but read (also in Definitions) from java.lang.Object whose classfile doesn't store parameter names.

And I have to reiterate that I'm not sure this is actually related to the scaladoc-specific issue. It could definitely help to fix a related named arguments issue, which I don't know the issue number of, if any exists.

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

5 participants