-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6255: Don't check unreachability for Expr[T] #6260
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
You can do =:= on termref which won't give any false positive, isn't that good enough? |
That will be on the safe side, but will not help in checking
|
Ah that's more complicated indeed, we do have a simple structural equality implementation for trees but I don't know if it's powerful enough for what you need: https://github.com/lampepfl/dotty/blob/eae5a38f24be24fbd6f9b583a687a7738747e5a0/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala#L785-L789 |
This seems to be the best strategy for now, given that the implicit args trick is only used for matching Expr[T]. Otherwise, we will need to reason equality of Terms, which is subtle.
@liufengyun can we have a comment documenting why checking unreachability does not work for // Ignore Expr for unreachability as a special case.
// Quote patterns produce repeated calls to the same unapply method,
// but with different implicit parameters.
// Since we understand repeated calls to the same unapply method to overlap
// and two unapply methods in one `match` with same arguments cannot normally have different implicits,
// the easiest solution is just to ignore Expr. |
@AleksanderBG Thanks for spelling it out, yes, that is what I have in mind. |
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!
This seems to be the best strategy for now, given that
the implicit args trick is only used for matching Expr[T],
and
case _ =>
is always used in such cases.Otherwise, we will need to reason equality of Terms, which is subtle.