forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
… is valid. (scala#22366) Review by @odersky because you seem to have been in the area recently with named tuples: scala@0fbdb49
- Loading branch information
Showing
3 changed files
with
56 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- [E108] Declaration Error: tests/neg/i21841.scala:20:13 -------------------------------------------------------------- | ||
20 | case v[T](l, r) => () // error | ||
| ^^^^^^^^^^ | ||
| [31mOption[(Test.Expr[Test.T], Test.Expr[Test.T])][0m is not a valid result type of an unapplySeq method of an [35mextractor[0m. | ||
| | ||
| longer explanation available when compiling with `-explain` |
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,22 @@ | ||
object Test { | ||
|
||
sealed trait T | ||
sealed trait Arrow[A, B] | ||
|
||
type ArgsTo[S1, Target] <: NonEmptyTuple = S1 match { | ||
case Arrow[a, Target] => Tuple1[Expr[a]] | ||
case Arrow[a, b] => Expr[a] *: ArgsTo[b, Target] | ||
} | ||
|
||
sealed trait Expr[S] : | ||
def unapplySeq[Target](e: Expr[Target]): Option[ArgsTo[S, Target]] = ??? | ||
|
||
case class Variable[S](id: String) extends Expr[S] | ||
|
||
val v = Variable[Arrow[T, Arrow[T, T]]]("v") | ||
val e : Expr[T] = ??? | ||
|
||
e match | ||
case v[T](l, r) => () // error | ||
case _ => () | ||
} |