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] {

Base/src/main/scala/internal/End.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package name.rayrobdod.stringContextParserCombinator
22
package internal
33

44
private[stringContextParserCombinator]
5-
final class End[Expr[_], Type[_]] extends Parser[Expr, Type, Unit] {
5+
final class End[Expr[+_], Type[_]] extends Parser[Expr, Type, Unit] {
66
override def interpolate[ExprZ <: Expr[Any], Pos](input:Input[ExprZ, Pos])(implicit ev1:Ordering[Pos]):Result[ExprZ, Pos, Unit] = {
77
this.parse(())(input)
88
}

Base/src/main/scala/internal/ExtractorAtom.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package internal
77
* As a parser, this will pass through the result of the backing parser.
88
*/
99
private[stringContextParserCombinator]
10-
final class ExtractorAtom[Expr[_], Type[_], A](
10+
final class ExtractorAtom[Expr[+_], Type[_], A](
1111
backing:Interpolator[Expr[Any], Expr[A]],
1212
tpeA:Type[A]
1313
) extends Parser[Expr, Type, Expr[A]] {

Base/src/main/scala/internal/Fail.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package internal
33

44
/** A parser that consumes no input and always fails */
55
private[stringContextParserCombinator]
6-
final class Fail[Expr[_], Type[_]](desc:ExpectingDescription) extends Parser[Expr, Type, Nothing] {
6+
final class Fail[Expr[+_], Type[_]](desc:ExpectingDescription) extends Parser[Expr, Type, Nothing] {
77
def interpolate[ExprZ <: Expr[Any], Pos](input:Input[ExprZ, Pos])(implicit ev1:Ordering[Pos]):Result[ExprZ, Pos, Nothing] = {
88
Failure(ExpectingSet(Expecting(desc, input.position)))
99
}

Base/src/main/scala/internal/Hide.scala

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

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

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

Base/src/main/scala/internal/Map.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Map {
1414
}
1515
}
1616

17-
def extractor[Expr[_], Type[_], A, Z](
17+
def extractor[Expr[+_], Type[_], A, Z](
1818
backing:Extractor[Expr, Type, A],
1919
contramapping: Z => A
2020
):Extractor[Expr, Type, Z] = {
@@ -25,7 +25,7 @@ object Map {
2525
}
2626
}
2727

28-
def parser[Expr[_], Type[_], A, Z](
28+
def parser[Expr[+_], Type[_], A, Z](
2929
backing:Parser[Expr, Type, A],
3030
mapping: A => Z,
3131
contramapping: Z => A

Base/src/main/scala/internal/Opaque.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Opaque {
1414
}
1515
}
1616

17-
def extractor[Expr[_], Type[_], A](
17+
def extractor[Expr[+_], Type[_], A](
1818
backing:Extractor[Expr, Type, A],
1919
description:ExpectingDescription
2020
):Extractor[Expr, Type, A] = {
@@ -25,7 +25,7 @@ object Opaque {
2525
}
2626
}
2727

28-
def parser[Expr[_], Type[_], A](
28+
def parser[Expr[+_], Type[_], A](
2929
backing:Parser[Expr, Type, A],
3030
description:ExpectingDescription
3131
):Parser[Expr, Type, A] = {

Base/src/main/scala/internal/Optionally.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Optionally {
1616
})
1717
}
1818

19-
def extractor[Expr[_], Type[_], A, Z](
19+
def extractor[Expr[+_], Type[_], A, Z](
2020
backing:Extractor[Expr, Type, A],
2121
strategy:RepeatStrategy,
2222
ev:typeclass.ContraOptionally[Expr, A, Z]
@@ -43,7 +43,7 @@ object Optionally {
4343
}
4444
}
4545

46-
def parser[Expr[_], Type[_], A, Z](
46+
def parser[Expr[+_], Type[_], A, Z](
4747
backing:Parser[Expr, Type, A],
4848
strategy:RepeatStrategy,
4949
ev:typeclass.BiOptionally[Expr, A, Z]

Base/src/main/scala/internal/OrElse.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object OrElse {
1515
}
1616
}
1717

18-
def extractor[Expr[_], Type[_], A, B, Z](
18+
def extractor[Expr[+_], Type[_], A, B, Z](
1919
left:Extractor[Expr, Type, A],
2020
right:Extractor[Expr, Type, B],
2121
combiner:typeclass.ContraEithered[Expr, A, B, Z]
@@ -27,7 +27,7 @@ object OrElse {
2727
}
2828
}
2929

30-
def parser[Expr[_], Type[_], A, B, Z](
30+
def parser[Expr[+_], Type[_], A, B, Z](
3131
left:Parser[Expr, Type, A],
3232
right:Parser[Expr, Type, B],
3333
combiner:typeclass.BiEithered[Expr, A, B, Z]
@@ -66,7 +66,7 @@ object OrElse {
6666
}
6767
}
6868

69-
private def extractor[Expr[_], Type[_], A, B, Z, Pos](
69+
private def extractor[Expr[+_], Type[_], A, B, Z, Pos](
7070
left:Extractor[Expr, Type, A],
7171
right:Extractor[Expr, Type, B],
7272
combiner:typeclass.ContraEithered[Expr, A, B, Z],

Base/src/main/scala/internal/Paired.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package internal
33

44
/** Acts like the Interpolator when interpolating, and like the Extractor when extracting */
55
private[stringContextParserCombinator]
6-
final class Paired[Expr[_], Type[_], A](
6+
final class Paired[Expr[+_], Type[_], A](
77
val interpolator:Interpolator[Expr[Any], A],
88
val extractor:Extractor[Expr, Type, A]
99
) extends Parser[Expr, Type, A] {

Base/src/main/scala/internal/Parser.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Interpolator[-Expr, +A] {
1010
}
1111

1212
private[stringContextParserCombinator]
13-
trait Extractor[Expr[_], Type[_], -A] {
13+
trait Extractor[Expr[+_], Type[_], -A] {
1414
def extractor[Pos](
1515
input:Input[Unit, Pos])(
1616
implicit ev1:Ordering[Pos],
@@ -19,6 +19,6 @@ trait Extractor[Expr[_], Type[_], -A] {
1919
}
2020

2121
private[stringContextParserCombinator]
22-
trait Parser[Expr[_], Type[_], A]
22+
trait Parser[Expr[+_], Type[_], A]
2323
extends Interpolator[Expr[Any], A]
2424
with Extractor[Expr, Type, A]

Base/src/main/scala/internal/Pass.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package internal
33

44
/** A parser that consumes no input and always succeeds */
55
private[stringContextParserCombinator]
6-
final class Pass[Expr[_], Type[_]] extends Parser[Expr, Type, Unit] {
6+
final class Pass[Expr[+_], Type[_]] extends Parser[Expr, Type, Unit] {
77
def interpolate[ExprZ <: Any, Pos](input:Input[ExprZ, Pos])(implicit ev1:Ordering[Pos]):Result[ExprZ, Pos, Unit] = {
88
Success((), input, ExpectingSet.empty)
99
}

Base/src/main/scala/internal/Repeat.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object Repeat {
3232
}
3333
}
3434

35-
def extractor[Expr[_], Type[_], A, Z](
35+
def extractor[Expr[+_], Type[_], A, Z](
3636
inner:Extractor[Expr, Type, A],
3737
min:Int,
3838
max:Int,
@@ -59,7 +59,7 @@ object Repeat {
5959
}
6060
}
6161

62-
def parser[Expr[_], Type[_], A, Z](
62+
def parser[Expr[+_], Type[_], A, Z](
6363
inner:Parser[Expr, Type, A],
6464
min:Int,
6565
max:Int,

0 commit comments

Comments
 (0)