-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Widen scrutinees in TypeComparer's compareMatch
If the skolem-widened scrutinees are the same and the cases correspond, then the match types are the same. Also, with inlining the type embeded in inlining's Typed expression will be without going through type-avoidance, so they won't be skolems. So we look to widen inline proxy term refs, in addition to skolems. Co-Authored-By: Matt Bovel <matthieu@bovel.net>
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
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,19 @@ | ||
import scala.compiletime.constValueTuple | ||
|
||
val ll0: Tuple3["one", "two", "three"] = constValueTuple[("one", "two", "three")] | ||
val ll1 = constValueTuple[("one", "two", "three")].toList | ||
val ll3: List["one" | ("two" | ("three" | Nothing))] = constValueTuple[("one", "two", "three")].toList | ||
val ll4: List["one" | ("two" | "three")] = constValueTuple[("one", "two", "three")].toList | ||
|
||
inline def labels[Labels <: Tuple](using ev: Tuple.Union[Labels] <:< String): List[String] = | ||
val tmp = constValueTuple[Labels].toList | ||
ev.substituteCo(tmp) | ||
|
||
def test = labels[("one", "two", "three")] | ||
|
||
def toList(x: Tuple): List[Tuple.Union[x.type]] = ??? | ||
def test2[Labels <: Tuple] = toList((???): Labels) | ||
|
||
def i16654 = | ||
def t1: Tuple = EmptyTuple | ||
val t2 = t1.toList |
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,7 @@ | ||
def toCsvFlat[A <: Product](a: A)(using m: scala.deriving.Mirror.ProductOf[A]) = { | ||
def flatTuple(any: Any): Tuple = any match | ||
case p: Product => p.productIterator.map(flatTuple).foldLeft(EmptyTuple: Tuple)(_ ++ _) | ||
case a => Tuple1(a) | ||
|
||
val tuple = flatTuple(Tuple.fromProductTyped(a)).toList | ||
} |