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

askTypeAt returns overloaded types #7548

Closed
scabug opened this issue Jun 3, 2013 · 7 comments
Closed

askTypeAt returns overloaded types #7548

scabug opened this issue Jun 3, 2013 · 7 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jun 3, 2013

Targeted type-checking in the presentation compiler is sometimes too precise. askTypeAt(pos) stops type-checking as soon as the smallest enclosing tree for pos has been typed. However, for overloaded method calls this is too early, since the type is not known before looking at the arguments.

This happens for any overloaded method call.

askTypeAt should be smarter, and continue type-checking if tree.tpe.isOverloadedType.

Observable outcomes of this (in the IDE) are unknown 'hovers', broken hyperlinking that suddenly starts working, unresolved ScalaDoc comments.

@scabug
Copy link
Author

@scabug scabug commented Jun 3, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7548?orig=1
Reporter: @dragos
Affected Versions: 2.10.2-RC2
Other Milestones: 2.11.0-M8

@scabug
Copy link
Author

@scabug scabug commented Jun 3, 2013

@vigdorchik said:
Checking for isOverloadedType looks less safe (why should the type-check continue, and what is the contract of askTypeAt if your fix is applied) than the IDE itself asking at the position of Apply. So why not fix it on the IDE side?

@scabug
Copy link
Author

@scabug scabug commented Oct 16, 2013

@dragos said:
Hey Eugene!

I think the contract is that "askTypeAt" should give you the same type whether the file was fully type-checked or "targeted" type-checked. Right now, if the file was fully type-checked the Select has the resolved symbol, while a targeted type-check gives back an overloaded type.

@scabug
Copy link
Author

@scabug scabug commented Oct 16, 2013

@vigdorchik said:
Hey Iulian,

That's a great idea to formalize the contract! What you say is the type returned by targeted type-check (if any) is the same as the type obtained by full type-check, right?
That would be great to have. However may it be that tree.tpe.isOverloadedType is not only true for method calls?
Seems analyzing tree structure is safer than type-checking enclosing tree unconditionally?

@scabug
Copy link
Author

@scabug scabug commented Nov 21, 2013

@dotta said:
I'm looking into this.

@scabug
Copy link
Author

@scabug scabug commented Nov 22, 2013

@scabug scabug closed this Dec 2, 2013
@scabug
Copy link
Author

@scabug scabug commented Dec 18, 2013

@scabug scabug added this to the 2.10.4-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants