Skip to content

Commit

Permalink
Add second test case from comment 1
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Mar 16, 2024
1 parent cb91472 commit 19d0ecb
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/pos/i19942.1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
trait Alternative[F[_]]

opaque type Derived[A] = A
object Derived:
extension [A](derived: Derived[A]) def instance: A = derived
infix type <<<[F[_], G[_]] = [x] =>> F[G[x]]

import Derived.*
import scala.compiletime.summonInline

type DerivedAlternative[F[_]] = Derived[Alternative[F]]
object DerivedAlternative:
inline def apply[F[_]]: Alternative[F] =
import DerivedAlternative.given
summonInline[DerivedAlternative[F]].instance
given nested[F[_], G[_]]: DerivedAlternative[F <<< G] = ???

object auto:
object alternative:
transparent inline given [F[_]]: Alternative[F] = DerivedAlternative[F]

trait Test:
import Test.*
import auto.alternative.given
val fails = summon[Alternative[OptList]]

// Fails if companion object defined AFTER trait
object Test:
type OptList[A] = Option[List[A]]

0 comments on commit 19d0ecb

Please sign in to comment.