-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix 14823: handle unions in companion path
- Loading branch information
1 parent
06a8f22
commit 16ed844
Showing
5 changed files
with
76 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Error: tests/neg/i14823.scala:8:50 ---------------------------------------------------------------------------------- | ||
8 |val baz = summon[Mirror.Of[SubA[Int] | SubB[Int]]] // error | ||
| ^ | ||
|no given instance of type deriving.Mirror.Of[SubA[Int] | SubB[Int]] was found for parameter x of method summon in object Predef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import deriving.Mirror | ||
|
||
case class Cov[+T]() | ||
|
||
class SubA[+T]() extends Cov[T] | ||
class SubB[+T]() extends Cov[T] | ||
|
||
val baz = summon[Mirror.Of[SubA[Int] | SubB[Int]]] // error | ||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
// this should fail because: | ||
// 1) SubA and SubB are not individually product types | ||
// 2) SubA and SubB are different classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import deriving.Mirror | ||
|
||
object MirrorK1: | ||
type Of[F[_]] = Mirror { type MirroredType[A] = F[A] } | ||
|
||
sealed trait Box[T] | ||
object Box | ||
|
||
case class Child[T]() extends Box[T] | ||
|
||
sealed abstract class Foo[T] | ||
object Foo { | ||
case class A[T]() extends Foo[T] | ||
} | ||
|
||
val foo = summon[Mirror.Of[Box[Int] | Box[Int]]] | ||
val bar = summon[MirrorK1.Of[[X] =>> Box[Int] | Box[Int]]] | ||
def baz = summon[deriving.Mirror.Of[Foo[String] | Foo[String]]] |