Skip to content
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

chore: Add test to close issue 2555 #5914

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -590,4 +590,82 @@ class SyntheticDecorationsSuite extends BaseSyntheticDecorationsSuite {
|}
|""".stripMargin
)

check(
"complex".tag(IgnoreScalaVersion.forLessThan("2.12.16")),
"""|object ScalatestMock {
| class SRF
| implicit val subjectRegistrationFunction: SRF = new SRF()
| class Position
| implicit val here: Position = new Position()
| implicit class StringTestOps(name: String) {
| def should(right: => Unit)(implicit config: SRF): Unit = ()
| def in(f: => Unit)(implicit pos: Position): Unit = ()
| }
| implicit def instancesString: Eq[String] with Semigroup[String] = ???
|}
|
|trait Eq[A]
|trait Semigroup[A]
|
|class DemoSpec {
| import ScalatestMock._
|
| "foo" should {
| "checkThing1" in {
| checkThing1[String]
| }
| "checkThing2" in {
| checkThing2[String]
| }
| }
|
| "bar" should {
| "checkThing1" in {
| checkThing1[String]
| }
| }
|
| def checkThing1[A](implicit ev: Eq[A]) = ???
| def checkThing2[A](implicit ev: Eq[A], sem: Semigroup[A]) = ???
|}
|""".stripMargin,
"""|object ScalatestMock {
| class SRF
| implicit val subjectRegistrationFunction: SRF = new SRF()
| class Position
| implicit val here: Position = new Position()
| implicit class StringTestOps(name: String) {
| def should(right: => Unit)(implicit config: SRF): Unit = ()
| def in(f: => Unit)(implicit pos: Position): Unit = ()
| }
| implicit def instancesString: Eq[String] with Semigroup[String] = ???
|}
|
|trait Eq[A]
|trait Semigroup[A]
|
|class DemoSpec {
| import ScalatestMock._
|
| StringTestOps("foo") should {
| StringTestOps("checkThing1") in {
| checkThing1[String](instancesString)
| }(here)
| StringTestOps("checkThing2") in {
| checkThing2[String](instancesString, instancesString)
| }(here)
| }(subjectRegistrationFunction)
|
| StringTestOps("bar") should {
| StringTestOps("checkThing1") in {
| checkThing1[String](instancesString)
| }(here)
| }(subjectRegistrationFunction)
|
| def checkThing1[A](implicit ev: Eq[A]): Nothing = ???
| def checkThing2[A](implicit ev: Eq[A], sem: Semigroup[A]): Nothing = ???
|}
|""".stripMargin
)
}
Loading