Skip to content

Commit 6f858c7

Browse files
committed
[base] Mark Expr higher-kinded type parameters as being covariant
1 parent 2e70c4a commit 6f858c7

29 files changed

+83
-83
lines changed

Base/src/main/scala-2/typeclass/ToExprMapping.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import scala.reflect.ClassTag
88
* Associates an Expr type with the implicit types required to lift a value into an Expr.
99
* Support for [[Interpolator.mapToExpr]].
1010
*/
11-
trait ToExprMapping[Expr[_], ToExpr[_], Type[_]] {
11+
trait ToExprMapping[Expr[+_], ToExpr[_], Type[_]] {
1212
def apply[A](value:A, fn:ToExpr[A], tpe: Type[A]):Expr[A]
1313
}
1414

Base/src/main/scala-3/typeclass/ToExprMapping.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import scala.reflect.ClassTag
77
* Associates an Expr type with the implicit types required to lift a value into an Expr.
88
* Support for [[Interpolator.mapToExpr]]
99
*/
10-
trait ToExprMapping[Expr[_], ToExpr[_], Type[_]] {
10+
trait ToExprMapping[Expr[+_], ToExpr[_], Type[_]] {
1111
def apply[A](value:A, fn:ToExpr[A], tpe: Type[A]):Expr[A]
1212
}
1313

Base/src/main/scala/Extractor.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import name.rayrobdod.stringContextParserCombinator.{Extractor => SCExtractor}
3131
* @groupname Misc Other Combinators
3232
* @groupprio Misc 1999
3333
*/
34-
final class Extractor[Expr[_], Type[_], -A] private[stringContextParserCombinator] (
34+
final class Extractor[Expr[+_], Type[_], -A] private[stringContextParserCombinator] (
3535
protected[stringContextParserCombinator] val impl: internal.Extractor[Expr, Type, A]
3636
) {
3737

@@ -372,7 +372,7 @@ object Extractor
372372
* Indirectly refers to a parser, to allow for mutual-recursion
373373
* @group Misc
374374
*/
375-
def `lazy`[Expr[_], Type[_], A](fn:Function0[SCExtractor[Expr, Type, A]]):SCExtractor[Expr, Type, A] =
375+
def `lazy`[Expr[+_], Type[_], A](fn:Function0[SCExtractor[Expr, Type, A]]):SCExtractor[Expr, Type, A] =
376376
new SCExtractor(internal.DelayedConstruction.extractor(() => fn().impl))
377377

378378
/**
@@ -558,7 +558,7 @@ trait VersionSpecificExtractorModule extends ExprIndependentExtractors[scala.quo
558558
/**
559559
* Extractors that do not introduce an input dependency on Expr
560560
*/
561-
private[stringContextParserCombinator] trait ExprIndependentExtractors[Expr[_], Type[_]] {
561+
private[stringContextParserCombinator] trait ExprIndependentExtractors[Expr[+_], Type[_]] {
562562
/**
563563
* Succeeds if the next character is a member of the given Set; captures that character
564564
* @group PartAsChar

Base/src/main/scala/Interpolator.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ final class Interpolator[-Expr, +A] private[stringContextParserCombinator] (
196196
* successful result into an Expr
197197
* @group Map
198198
*/
199-
def mapToExpr[Z >: A, Expr2[_], ToExpr[_], Type[_]](
199+
def mapToExpr[Z >: A, Expr2[+_], ToExpr[_], Type[_]](
200200
implicit mapping:typeclass.ToExprMapping[Expr2, ToExpr, Type],
201201
toExpr:ToExpr[Z],
202202
tpe:Type[Z]
@@ -259,7 +259,7 @@ final class Interpolator[-Expr, +A] private[stringContextParserCombinator] (
259259
* The extractor parsing will probably fail if this parser expects to find holes.
260260
* @group Misc
261261
*/
262-
def extractorAtom[ExprZ[_], TypeZ[_], UnexprA](
262+
def extractorAtom[ExprZ[+_], TypeZ[_], UnexprA](
263263
implicit t:TypeZ[UnexprA],
264264
ev:ExprZ[Any] <:< Expr,
265265
ev2:A <:< ExprZ[UnexprA]

Base/src/main/scala/Parser.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import name.rayrobdod.stringContextParserCombinator.{Parser => SCPCParser}
3434
* @groupname Convert convert
3535
* @groupprio Convert 2000
3636
*/
37-
final class Parser[Expr[_], Type[_], A] private[stringContextParserCombinator] (
37+
final class Parser[Expr[+_], Type[_], A] private[stringContextParserCombinator] (
3838
protected[stringContextParserCombinator] val impl: internal.Parser[Expr, Type, A]
3939
) {
4040

@@ -365,7 +365,7 @@ object Parser
365365
* A parser that acts like the Interpolator when interpolating, and like the Extractor when extracting
366366
* @group Misc
367367
*/
368-
def paired[Expr[_], Type[_], A](
368+
def paired[Expr[+_], Type[_], A](
369369
interpolator:SCPCInterpolator[Expr[Any], A],
370370
extractor:SCPCExtractor[Expr, Type, A]
371371
):SCPCParser[Expr, Type, A] =
@@ -375,7 +375,7 @@ object Parser
375375
* Indirectly refers to a parser, to allow for mutual-recursion
376376
* @group Misc
377377
*/
378-
def `lazy`[Expr[_], Type[_], A](fn:Function0[SCPCParser[Expr, Type, A]]):SCPCParser[Expr, Type, A] =
378+
def `lazy`[Expr[+_], Type[_], A](fn:Function0[SCPCParser[Expr, Type, A]]):SCPCParser[Expr, Type, A] =
379379
new SCPCParser(internal.DelayedConstruction.parser(() => fn().impl))
380380

381381
// The `ToExpr` tparam isn't used directly, but it does help type inference at use sites
@@ -570,7 +570,7 @@ trait VersionSpecificParserModule extends ExprIndependentParsers[scala.quoted.Ex
570570
/**
571571
* Parsers that do not introduce an input dependency on Expr
572572
*/
573-
private[stringContextParserCombinator] trait ExprIndependentParsers[Expr[_], Type[_]] {
573+
private[stringContextParserCombinator] trait ExprIndependentParsers[Expr[+_], Type[_]] {
574574
/**
575575
* Succeeds if the next character is a member of the given Set; captures that character
576576
* @group PartAsChar

Base/src/main/scala/PartialExprFunction.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package name.rayrobdod.stringContextParserCombinator
33
/**
44
* A partial function which is valid according to an `Expr[Boolean]` instead of a plain `Boolean`
55
*/
6-
trait PartialExprFunction[+Expr[_], -A, +Z] {
6+
trait PartialExprFunction[+Expr[+_], -A, +Z] {
77
def isDefinedAt(a:A):Expr[Boolean]
88
def apply(a:A):Z
99
}
1010

1111
object PartialExprFunction {
12-
def apply[Expr[_], A, Z](
12+
def apply[Expr[+_], A, Z](
1313
isDefinedAtFn:A => Expr[Boolean],
1414
applyFn:A => Z
1515
):PartialExprFunction[Expr, A, Z] = {
@@ -20,7 +20,7 @@ object PartialExprFunction {
2020
}
2121

2222
private[stringContextParserCombinator]
23-
def identity[Expr[_], A](
23+
def identity[Expr[+_], A](
2424
constTrue:Expr[Boolean]
2525
):PartialExprFunction[Expr, A, A] = {
2626
new PartialExprFunction[Expr, A, A] {

Base/src/main/scala/UnapplyExpr.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import scala.reflect.ClassTag
66
* The data needed to create an Unapply
77
*/
88
private[stringContextParserCombinator]
9-
final case class UnapplyExpr[+Expr[_], +Type[_], -A] (
9+
final case class UnapplyExpr[+Expr[+_], +Type[_], -A] (
1010
condition: A => Expr[Boolean],
1111
parts: List[UnapplyExpr.Part[Expr, Type, A, _]]
1212
)
1313

1414
private[stringContextParserCombinator]
1515
object UnapplyExpr {
16-
final case class Part[+Expr[_], +Type[_], -A, Z](typ: Type[Z], value: A => Expr[Z]) {
16+
final case class Part[+Expr[+_], +Type[_], -A, Z](typ: Type[Z], value: A => Expr[Z]) {
1717
def contramapValue[B](contrafn: B => A):Part[Expr, Type, B, Z] = new Part(typ, contrafn.andThen(value))
1818
}
1919
}
2020

2121
private[stringContextParserCombinator]
22-
trait UnapplyExprs[Expr[_], Type[_]] {
22+
trait UnapplyExprs[Expr[+_], Type[_]] {
2323
def empty:UnapplyExpr[Expr, Type, Any]
2424

2525
def isChar(expecting:Char):UnapplyExpr[Expr, Type, Char]
@@ -74,7 +74,7 @@ trait UnapplyExprs[Expr[_], Type[_]] {
7474
private[stringContextParserCombinator]
7575
object UnapplyExprs extends VersionSpecificUnapplyExprs {
7676
private[stringContextParserCombinator]
77-
abstract class Common[Expr[_], Type[_]](
77+
abstract class Common[Expr[+_], Type[_]](
7878
`true`: Expr[Boolean],
7979
`false`: Expr[Boolean],
8080
andBooleans: (Expr[Boolean], () => Expr[Boolean]) => Expr[Boolean]

Base/src/main/scala/internal/AndThen.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object AndThen {
2020
}
2121
}
2222

23-
def extractor[Expr[_], Type[_], A, B, Z](
23+
def extractor[Expr[+_], Type[_], A, B, Z](
2424
left:Extractor[Expr, Type, A],
2525
right:Extractor[Expr, Type, B],
2626
combiner:typeclass.ContraSequenced[A, B, Z]
@@ -39,7 +39,7 @@ object AndThen {
3939
}
4040
}
4141

42-
def parser[Expr[_], Type[_], A, B, Z](
42+
def parser[Expr[+_], Type[_], A, B, Z](
4343
left:Parser[Expr, Type, A],
4444
right:Parser[Expr, Type, B],
4545
combiner:typeclass.BiSequenced[A, B, Z]

Base/src/main/scala/internal/Attempt.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object Attempt {
1313
}
1414
}
1515

16-
def extractor[Expr[_], Type[_], A](
16+
def extractor[Expr[+_], Type[_], A](
1717
backing:Extractor[Expr, Type, A]
1818
):Extractor[Expr, Type, A] = {
1919
new Extractor[Expr, Type, A] {
@@ -23,7 +23,7 @@ object Attempt {
2323
}
2424
}
2525

26-
def parser[Expr[_], Type[_], A](
26+
def parser[Expr[+_], Type[_], A](
2727
backing:Parser[Expr, Type, A]
2828
):Parser[Expr, Type, A] = {
2929
new Parser[Expr, Type, A] {

Base/src/main/scala/internal/DelayedConstruction.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object DelayedConstruction {
1313
}
1414
}
1515

16-
def extractor[Expr[_], Type[_], A](
16+
def extractor[Expr[+_], Type[_], A](
1717
backing:() => Extractor[Expr, Type, A]
1818
):Extractor[Expr, Type, A] = {
1919
new Extractor[Expr, Type, A] {
@@ -23,7 +23,7 @@ object DelayedConstruction {
2323
}
2424
}
2525

26-
def parser[Expr[_], Type[_], A](
26+
def parser[Expr[+_], Type[_], A](
2727
backing:() => Parser[Expr, Type, A]
2828
):Parser[Expr, Type, A] = {
2929
new Parser[Expr, Type, A] {

0 commit comments

Comments
 (0)