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
Fix issue 263 #296
Fix issue 263 #296
Conversation
Codecov Report
@@ Coverage Diff @@
## main #296 +/- ##
==========================================
- Coverage 96.43% 96.41% -0.03%
==========================================
Files 8 8
Lines 1011 1031 +20
Branches 81 95 +14
==========================================
+ Hits 975 994 +19
- Misses 36 37 +1
Continue to review full report at Codecov.
|
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 only that 🎨 nits
Also, we could update this one as well
cats-parse/core/shared/src/main/scala/cats/parse/Parser.scala
Lines 1651 to 1654 in a9a1eed
case f @ (Impl.Fail() | Impl.FailWith(_)) => | |
// these are really Parser[Nothing] | |
// but scala can't see that, so we cast | |
f.asInstanceOf[Parser[String]] |
case f @ Impl.Fail() => f.widen | ||
case f @ Impl.FailWith(_) => f.widen |
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.
nit 🎨
case f @ Impl.Fail() => f.widen | |
case f @ Impl.FailWith(_) => f.widen | |
case f: Impl.Fail[A] => f.widen | |
case f: Impl.FailWith[A] => f.widen |
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.
There are a few more cases below
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.
Curious why you like this change? I prefer the opposite. I think the compile to the same code don't they?
I don't like general reflective matching and to a reviewer the :
style might be that, so they have to read a bit carefully.
But I'm interested to know your view on it.
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.
You got me curious as well because my main motivation for this was based on the fact that this generated different bytecode before. However, after a quick check with this use case, I remembered things badly and they do in fact generate the same bytecode. That said, I'm totally ok with it 😄
You might be right on it needing careful reading but the current one imo has a slight "disadvantage" of keeping track of the number of args. It's not worth changing because of this.
going to merge now... if you want to replace pattern matches with class name matches, we can certainly do that later but there are many examples of pattern matches and I'd like to understand better the motivation. |
close #263
I made sure all the previous failures are no longer failures.
This fixes in a couple of ways:
This should be performance neutral or possibly slightly faster.