-
Notifications
You must be signed in to change notification settings - Fork 308
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
Fix tooltip message for 'var's #1005
Fix tooltip message for 'var's #1005
Conversation
Distinguish var from def by checking if the owner has both a setter and a getter with the same name Fix #1001007
Refer to this link for build results (access rights to CI server needed): |
The formatting is still not perfect (if it had changed at all), but I don't want to be too pedantic. Therefore, LGTM. |
…shed Fix tooltip message for 'var's
Thanks |
def hasGetterSetter(sym:Symbol)= gsym != NoSymbol && sym.setterIn(sym.owner) != NoSymbol | ||
|
||
if(hasGetterSetter(sym)){ | ||
compose("", "var",sym.localName.toString.trim+": "+gsym.tpe.resultType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is working very well, since modifiers are eluded and hardcoded to ""
. What about private/protected
vars?. Also, the type should be printed using the same calls as in the original code. I think the proper way would be to use the getter symbol for all of these. For an example about the type:
trait Foo[T] {
var x: T = _
}
class C extends Foo[Int] {
prinntl(x) // x: Int or x: T?
}
Yes, I agree. It is not perfect. I hardcoded modifiers to "" because they are wrong any way. In simple case |
@andrey-ilinykh I think there is at least one symbol (not the field, but probably the getter) that has the correct flags. We should use those. |
Distinguish var from def by checking if the owner has both a setter and
a getter with the same name
Fix #1001007