-
Notifications
You must be signed in to change notification settings - Fork 92
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 compiler warning about non-exhaustive match #83
Conversation
Face Palm. Big thanks for correcting my spell mistakes. |
@biswanaths Would it be possible to write a unit test that verifies that I didn't introduce a bug, and that I preserved the fix in in #59? Seems like a unit test that uses a counter to count the number of times a function was called, as was shown in https://issues.scala-lang.org/browse/SI-4528 could do that? |
Sure @ashawley, let me look into writing the mentioned unit test. The counter validation will definitely strengthen validation any fix, pointing linear time complexity. |
Is there a way to write a count test for the code, without modifying the existing code ? I was thinking of inheriting and overriding the transform ( https://github.com/scala/scala-xml/blob/master/src/main/scala/scala/xml/transform/BasicTransformer.scala#L34) + plus incrementing the state in the derived. Any other ways, people can think of ? |
@biswanaths Yes, using a var counter seems appropriate to me. |
Ok, will submit a pull request with that. |
@biswanaths I've added one for you. When you've verified the new unit test and merged it, I will rebase and push this PR so the Travis checks can run again. |
01157da
to
36a9b22
Compare
@biswanaths Thanks! After you merged, I've rebased and re-pushed this branch. Looks like the checks still passed. |
36a9b22
to
7aaa833
Compare
7aaa833
to
b3802e1
Compare
f42d1b3
to
fca8638
Compare
src/test/scala/scala/xml/ReuseNodesTest.scala:86: match may not be exhaustive. It would fail on the following inputs: (List(_), Nil), (Nil, List(_)) (original.toList,transformed.toList) match { ^ one warning found
fca8638
to
713d2d9
Compare
@ashawley , this looks good to me. Should we merge this in ? |
@biswanaths Yes, it is ready to go. It has the latest commits from master. I think it is worth merging. It would be nice to get rid of the warnings from the build output in SBT. |
Thanks @ashawley . Sorry that I missed it for long time. |
Specific warning looks like this:
Seems like the method could be rewritten to just use
zip
andforeach
. Could someone review to make sure the assertion still works, though? I wasn't sure how to breakscala.xml.transform.BasicTransformer
to verify.