-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3348: use a new typeState in inferView #3354
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
Conversation
`inferImplicit` has an useful invariant that the constraint doesn't change in the case of implicit resolution failure. However, this invariant may not hold if completions are triggered during implicit resolution. By create a new typeState for inferView, we ensure that the useful invariant holds in such cases.
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/3354/ to see the changes. Benchmarks is based on merging with master (174444d) |
You forgot to add the test case |
I am not sure anymore whether we should undo completions when an implicit search fails. We have at least three choices here:
I think we need to dig deeper to decide which of the three is the right strategy. |
My feeling is that the assertion is a useful invariant to guard against other mistakes, thus I would make choice 1 as last resort. For 2nd solution, actually the errors that emitted during completion are reported, as the following example shows: class Test {
import Test.test
"Hello".toto // error
}
object Test {
def test = {
abc // <== error reported
implicitly[collection.generic.CanBuildFrom[List[Int], Int, List[Int]]]
}
} Or there are may be other cases that I'm ignorant of. The 3rd option sounds good, I'll have a look. |
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
Fix #3348
inferImplicit
has a useful invariant that the constraint doesn'tchange in the case of implicit resolution failure. However, this
invariant may not hold if completions are triggered during implicit resolution.
By create a new typeState for inferView, we ensure that the useful
invariant holds in such cases.