-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
.raiseError syntax allows an error subtype #2511
.raiseError syntax allows an error subtype #2511
Conversation
} | ||
|
||
test("raiseError syntax allows an error subtype") { | ||
assert(Sub.raiseError[EitherWrapper, Unit].either.isLeft) |
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.
I couldn't keep should ===
convention here due to the lack of org.scalactic.CanEqual[Either[Super, Unit]]
. Any advice?
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.
Not sure if you need a new instance to test. I assume that the test could be in a form of following code compiles
def a[F[_]](implicit F: ApplicativeError[F, CharSequence]): F[Int] =
"sdf".raiseError[F, Int]
This doesn't compile without your change, since "sdf".raiseError
would requires a ApplicativeError[F, String])
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.
That's much better! I'll take it and move to SyntaxSuite
.
9813b36
to
bdf9f9e
Compare
Codecov Report
@@ Coverage Diff @@
## master #2511 +/- ##
=======================================
Coverage 95.38% 95.38%
=======================================
Files 357 357
Lines 6528 6528
Branches 281 281
=======================================
Hits 6227 6227
Misses 301 301
Continue to review full report at Codecov.
|
Applied @kailuowang's feedback and confirmed that new test doesn't compile with current master:
|
053b5d3
to
e2da593
Compare
Codecov Report
@@ Coverage Diff @@
## master #2511 +/- ##
=======================================
Coverage 95.38% 95.38%
=======================================
Files 357 357
Lines 6528 6528
Branches 281 278 -3
=======================================
Hits 6227 6227
Misses 301 301
Continue to review full report at Codecov.
|
I don't see any reason of the CI failure in scala 2.13.0-M4 😢 |
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.
Thanks!
Heh, nice to see that my PR inspired somebody literally at the other end of the world! |
Inspired by #2480, applying the same trick to
.raiseError
so that I can writeMyException(...).raiseError[IO, Unit]
, instead of(MyException(...): Throwable).raiseError[IO, Unit]
.