-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adjust owner in Interactive.contextOfPath
causing crash in ImplicitSearch
#19875
Conversation
…ash after given loop detection
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.
LGTM! I just now realized that maybe we could use the context returned by contextOfPath to determine which names can be printed without a qualifying path (so like ShortenedTypePrinter, but could be re-used for compiler error messages), does that make any sense?
Also it seems like this should be backported to 3.4.1. (I assume the given loop change isn't in 3.3 ?) |
This is actually a good idea. I think current If we approach this problem in error messages, we can shorten types to current scope. // fileA.scala
package test.api
class Foo()
def test(x: Foo): Unit = ??? // fileB.scala
package test.newApi
class Foo(x: Int)
test.api.test(Foo(5)) // it should report
// type mismatch;
// found: newApi.Foo
// required: api.Foo
// test.api.test(Foo(5))
// ^^^^^^ |
…tSearch` (scala#19875) `Interactive` provided us with the method `contextOfPath` which should return enclosing ctx for given position. It was working fine until given loop detection was improved some time ago. It started crashing as the context owner was set to original context owner, instead of the real owner. This PR changes this and sets context to its outer context owner. Fixes scalameta/metals#6193
…tSearch` (#19875) `Interactive` provided us with the method `contextOfPath` which should return enclosing ctx for given position. It was working fine until given loop detection was improved some time ago. It started crashing as the context owner was set to original context owner, instead of the real owner. This PR changes this and sets context to its outer context owner. Fixes scalameta/metals#6193 [Cherry-picked 9cc9107]
Interactive
provided us with the methodcontextOfPath
which should return enclosing ctx for given position. It was working fine until given loop detection was improved some time ago.It started crashing as the context owner was set to original context owner, instead of the real owner. This PR changes this and sets context to its outer context owner.
Fixes scalameta/metals#6193