-
Notifications
You must be signed in to change notification settings - Fork 1.1k
$conforms[Nothing] shows up as a placeholder for missing implicits #8053
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
Comments
I’ve tried to work on this issue today but I’m not sure where this is going…
|
As far as I understood, when we filter the given candidates, the comparison function does not take type parameter constraints into account. This is why a term with type You can reproduce the problem described in the first comment with this code: summon[Int => String] Gives the following error:
Since However, I’m not sure how to achieve this: if we try to fully type-check the given candidates when we filter them, this will surely slow down the compilation a lot… What do you think of filtering the given candidates in two steps? First, the same step as the current filtering step, and then a second step which would try to type-chek only those that have passed the first step? |
Fixes #8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. However, I believe that if there is a type mismatch, then the candidate should not be a candidate in the first place. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch. Hopefully this won’t have a negative impact. I’ve added a couple of tests that used to report a mismatch for the "candidate" `$conforms[Nothing]` and they now report that no given could be found. One existing test was broken by my changes. This test was very similar to the ones described in #8053, so I’ve changed the test expectation.
Fixes #8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. However, I believe that if there is a type mismatch, then the candidate should not be a candidate in the first place. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch. Hopefully this won’t have a negative impact. I’ve added a couple of tests that used to report a mismatch for the "candidate" `$conforms[Nothing]` and they now report that no given could be found. One existing test was broken by my changes. This test was very similar to the ones described in #8053, so I’ve changed the test expectation.
Fixes #8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. However, I believe that if there is a type mismatch, then the candidate should not be a candidate in the first place. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch. Hopefully this won’t have a negative impact. I’ve added a couple of tests that used to report a mismatch for the "candidate" `$conforms[Nothing]` and they now report that no given could be found. One existing test was broken by my changes. This test was very similar to the ones described in #8053, so I’ve changed the test expectation.
…[Nothing]` and `<:<.refl[Nothing]` Fixes scala#8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. The goal is to report an error as precise as possible to the user. However, in some cases showing the inferred candidate brings no value to the user, especially when the candidate is uninhabited. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch when `$conforms[Nothing]` or `<:<.refl` are inferred because these values are uninhabited and might be confusing for end users.
…[Nothing]` and `<:<.refl[Nothing]` Fixes scala#8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. The goal is to report an error as precise as possible to the user. However, in some cases showing the inferred candidate brings no value to the user, especially when the candidate is uninhabited. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch when `$conforms[Nothing]` or `<:<.refl` are inferred because these values are uninhabited and might be confusing for end users.
…[Nothing]` and `<:<.refl[Nothing]` Fixes scala#8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. The goal is to report an error as precise as possible to the user. However, in some cases showing the inferred candidate brings no value to the user, especially when the candidate is uninhabited. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch when `$conforms[Nothing]` or `<:<.refl` are inferred because these values are uninhabited and might be confusing for end users.
…[Nothing]` and `<:<.refl[Nothing]` Fixes scala#8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. The goal is to report an error as precise as possible to the user. However, in some cases showing the inferred candidate brings no value to the user, especially when the candidate is uninhabited. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch when `$conforms[Nothing]` or `<:<.refl` are inferred because these values are uninhabited and might be confusing for end users.
…[Nothing]` and `<:<.refl[Nothing]` Fixes scala#8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. The goal is to report an error as precise as possible to the user. However, in some cases showing the inferred candidate brings no value to the user, especially when the candidate is uninhabited. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch when `$conforms[Nothing]` or `<:<.refl` are inferred because these values are uninhabited and might be confusing for end users.
…[Nothing]` and `<:<.refl[Nothing]` Fixes scala#8053 When a given candidate turns out to not be applicable we used to report that there is a mismatch between the candidate type and the expected type. The goal is to report an error as precise as possible to the user. However, in some cases showing the inferred candidate brings no value to the user, especially when the candidate is uninhabited. I’ve changed the failure to be a `NoMatchingImplicitsFailure` instead of a mismatch when `$conforms[Nothing]` or `<:<.refl` are inferred because these values are uninhabited and might be confusing for end users.
Uh oh!
There was an error while loading. Please reload this page.
minimized code
https://scastie.scala-lang.org/27qWTarCSHyAW7OtgXGGvg
The error message unexpectedly mentions
$conform[Nothing]
.expectation
The error message should be:
(there should be no “I found: ...” part)
The text was updated successfully, but these errors were encountered: