Skip to content

Fix #2743: Fix hover problem #2744

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

Merged
merged 4 commits into from
Jun 15, 2017
Merged

Fix #2743: Fix hover problem #2744

merged 4 commits into from
Jun 15, 2017

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 13, 2017

Also add an assert in isRef to track down a stackoverflow going infinitely often
through this line. Hopefully the assert will track that down.

Also add an assert in isRef to track down a stackoverflow going infinitely often
through this line. Hopefully the assert will track that down.
@odersky odersky requested a review from smarter June 13, 2017 14:01
@@ -297,7 +297,7 @@ class DottyLanguageServer extends LanguageServer
implicit val ctx = driver.currentCtx

val pos = sourcePosition(driver, uri, params.getPosition)
val tp = Interactive.enclosingType(driver.openedTrees(uri), pos)
val tp = Interactive.enclosingType(driver.openedTrees.getOrElse(uri, Nil), pos)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's many calls to openedTrees(uri) in this file, so instead of fixing it here I would change the definition of openedTrees.

@odersky
Copy link
Contributor Author

odersky commented Jun 13, 2017

@smarter I followed your suggestion. What about openedFiles? I thought of having that return a NoSource as default, but got pause by this comment in InteractiveDriver:

val source = driver.openedFiles(uri) // might throw exception

So we want it to throw that exception?

@smarter
Copy link
Member

smarter commented Jun 13, 2017

No that comment was more here to make me remember to decide how to handle the error cases, but it looks like I didn't :)

@smarter smarter closed this Jun 13, 2017
@smarter smarter reopened this Jun 13, 2017
@odersky
Copy link
Contributor Author

odersky commented Jun 13, 2017

OK, openedFiles gets a default as well.

@@ -125,7 +125,7 @@ object Types {
def isRef(sym: Symbol)(implicit ctx: Context): Boolean = stripAnnots.stripTypeVar match {
case this1: TypeRef =>
this1.info match { // see comment in Namer#typeDefSig
case TypeAlias(tp) => tp.isRef(sym)
case TypeAlias(tp) => assert((tp ne this) && (tp ne this), tp); tp.isRef(sym)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same condition repeated twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be this1. I think it was a merge breakage.

@smarter smarter merged commit 21b3149 into scala:master Jun 15, 2017
@allanrenucci allanrenucci deleted the fix-hover branch December 14, 2017 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants