question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make the arb.choice function take derived classes

See original GitHub issue

I am using the new Arb.choice function (Kotest version 4.0.5) and when I use derived classes I need to cast them. For example

    Arb.choice(
        Arb.constant(RuntimeException(message)) as Arb<Exception>,
        Arb.constant(Exception(message)),
        Arb.constant(IllegalArgumentException(message)) as Arb<Exception>,
        Arb.constant(IllegalStateException(message)) as Arb<Exception>
    )

I would like to know if it is possible to declare their types internally as anything that derive from T so I won’t need to cast them. Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
ataronetcommented, May 3, 2020

👍 Thank you, it works!!

1reaction
sksamuelcommented, Apr 30, 2020

If you’re ready with it james make sense to take yours.

On Thu, 30 Apr 2020, 11:18 James Pittendreigh, notifications@github.com wrote:

Ah this is my fault/bug, I prepared a fix, but don’t want to step on any toes if you wanted to raise a PR (master…jaymoid:arbVarianceFix https://github.com/kotest/kotest/compare/master...jaymoid:arbVarianceFix )

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kotest/kotest/issues/1422#issuecomment-621956211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGRGUF5YVF4L5VQDFZTRPGQGTANCNFSM4MTL5Q7A .

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Different Therapeutic Choices with ARBs. Which One to ...
For hypertensive patients at a higher risk of stroke, losartan should be the first therapeutic option; telmisartan, eprosartan and candesartan ...
Read more >
1. Inheritance hierarchies 2. Implementing derived classes 3 ...
Implementing derived classes. 3. Overriding member functions. 4. Virtual functions and polymorphism. Big C++ by Cay Horstmann.
Read more >
Choice of drug therapy in primary (essential) hypertension
In most patients, the drugs should be selected from among the three preferred classes (ie, ACE inhibitors [or ARBs], calcium channel blockers, ...
Read more >
Angiotensin receptor blockers (ARBs) - Heart Matters magazine
ARBs treat heart failure and high blood pressure and may be prescribed following a heart attack. We explain how they work, what they're...
Read more >
Derived classes - cppreference.com
Any class type (whether declared with class-key class or struct ) may be declared as derived from one or more base classes which,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found