Skip to content

Commit 0d1a1f2

Browse files
authored
Update scalameta to 4.4.3
1 parent 06ff918 commit 0d1a1f2

File tree

16 files changed

+106
-109
lines changed

16 files changed

+106
-109
lines changed

build.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ThisBuild / organization := "io.higherkindness"
22
ThisBuild / githubOrganization := "47degrees"
3-
ThisBuild / scalaVersion := "2.13.2"
4-
ThisBuild / crossScalaVersions := Seq("2.12.11", "2.13.2")
3+
ThisBuild / scalaVersion := "2.13.4"
4+
ThisBuild / crossScalaVersions := Seq("2.12.12", "2.13.2")
55

66
addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; microsite/mdoc; testCovered")
77
addCommandAlias("ci-docs", "github; documentation/mdoc; headerCreateAll; microsite/publishMicrosite")
@@ -62,7 +62,7 @@ lazy val commonSettings = Seq(
6262
"io.circe" %% "circe-core" % "0.13.0",
6363
"io.circe" %% "circe-parser" % "0.13.0",
6464
"io.circe" %% "circe-yaml" % "0.13.1",
65-
"org.scalameta" %% "scalameta" % "4.4.1",
65+
"org.scalameta" %% "scalameta" % "4.4.3",
6666
"com.julianpeeters" %% "avrohugger-core" % "1.0.0-RC22" % Test,
6767
"org.typelevel" %% "cats-laws" % "2.3.1" % Test,
6868
"io.circe" %% "circe-testing" % "0.13.0" % Test,

microsite/docs/docs/optimizations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def namedTypesTrans[T]: Trans[MuF, MuF, T] = Trans {
5959
case other => other
6060
}
6161

62-
def namedTypes[T: Basis[MuF, ?]]: T => T = scheme.cata(namedTypesTrans.algebra)
63-
def nestedNamedTypes[T: Basis[MuF, ?]]: T => T = scheme.cata(nestedNamedTypesTrans.algebra)
62+
def namedTypes[T: Basis[MuF, *]]: T => T = scheme.cata(namedTypesTrans.algebra)
63+
def nestedNamedTypes[T: Basis[MuF, *]]: T => T = scheme.cata(nestedNamedTypesTrans.algebra)
6464
```
6565

6666
and then apply the `namedTypes` combinator to the AST:

src/main/scala/higherkindness/skeuomorph/mu/Optimize.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ object Optimize {
7777
case other => other
7878
}
7979

80-
def namedTypes[T: Basis[MuF, ?]]: T => T = scheme.cata(namedTypesTrans.algebra)
81-
def nestedNamedTypes[T: Basis[MuF, ?]]: T => T = scheme.cata(nestedNamedTypesTrans.algebra)
82-
def toRequiredTypes[T: Basis[MuF, ?]]: T => T = scheme.cata(toRequiredTypesTrans.algebra)
83-
def nestedOptionInCoproduct[T: Basis[MuF, ?]]: T => T = scheme.cata(nestedOptionInCoproductsTrans.algebra)
80+
def namedTypes[T: Basis[MuF, *]]: T => T = scheme.cata(namedTypesTrans.algebra)
81+
def nestedNamedTypes[T: Basis[MuF, *]]: T => T = scheme.cata(nestedNamedTypesTrans.algebra)
82+
def toRequiredTypes[T: Basis[MuF, *]]: T => T = scheme.cata(toRequiredTypesTrans.algebra)
83+
def nestedOptionInCoproduct[T: Basis[MuF, *]]: T => T = scheme.cata(nestedOptionInCoproductsTrans.algebra)
8484

8585
/**
8686
* micro-optimization to convert known coproducts to named types
@@ -110,5 +110,5 @@ object Optimize {
110110
case other => other
111111
}
112112

113-
def knownCoproductTypes[T: Basis[MuF, ?]]: T => T = scheme.cata(knownCoproductTypesTrans.algebra)
113+
def knownCoproductTypes[T: Basis[MuF, *]]: T => T = scheme.cata(knownCoproductTypesTrans.algebra)
114114
}

src/main/scala/higherkindness/skeuomorph/mu/codegen.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ object codegen {
154154
t"_root_.shapeless.tag.@@[_root_.scala.Long, ${intModsToType(modifiers)}]"
155155
}
156156

157-
val algebra: AlgebraM[Either[String, ?], MuF, Tree] = AlgebraM {
157+
val algebra: AlgebraM[Either[String, *], MuF, Tree] = AlgebraM {
158158
case TNull() => t"_root_.higherkindness.mu.rpc.protocol.Empty.type".asRight
159159
case TDouble() => t"_root_.scala.Double".asRight
160160
case TFloat() => t"_root_.scala.Float".asRight
161161
case x @ TInt(_) => intType(x).asRight
162162
case TBoolean() => t"_root_.scala.Boolean".asRight
163163
case TString() => t"_root_.java.lang.String".asRight
164164
case TByteArray(Length.Arbitrary) => t"_root_.scala.Array[Byte]".asRight
165-
case TByteArray(Length.Fixed(n, _, l)) =>
165+
case TByteArray(Length.Fixed(n, _, l @ _)) =>
166166
val aliasedType = t"_root_.scala.Array[Byte]"
167167
q"""object ${Term.Name(n)} {
168168
type ${Type.Name(n)} = ${aliasedType}
@@ -244,7 +244,7 @@ object codegen {
244244
}
245245
case TDate() => t"_root_.java.time.LocalDate".asRight
246246
case TInstant() => t"_root_.java.time.Instant".asRight
247-
case TDecimal(precision, scale) =>
247+
case TDecimal(precision @ _, scale @ _) =>
248248
t"_root_.scala.math.BigDecimal".asRight
249249
}
250250

src/main/scala/higherkindness/skeuomorph/mu/comparison/Comparison.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ object Comparison extends ComparisonInstances {
112112
* Performs the comparison of two schemas
113113
*
114114
* Compares two schemas to verify that messages written using the writer schema are compatible with the reader schema.
115-
* Both schemas' roots are shallowly compared to unfold a `Comparison[T, ?]`, to compare their children or to signal a result.
115+
* Both schemas' roots are shallowly compared to unfold a `Comparison[T, *]`, to compare their children or to signal a result.
116116
* Comparison branches are then folded back by combining their results.
117117
*
118118
* WARNING: The current implementation does a lot of "useless" comparisons when it comes to compare coproducts. This is due to
@@ -123,7 +123,7 @@ object Comparison extends ComparisonInstances {
123123
* @param writer
124124
* @param reader
125125
*/
126-
def apply[T](writer: T, reader: T)(implicit ev: Basis[MuF, T], F: Functor[Comparison[T, ?]]): Result[T] =
126+
def apply[T](writer: T, reader: T)(implicit ev: Basis[MuF, T], F: Functor[Comparison[T, *]]): Result[T] =
127127
scheme
128128
.hylo(Algebra(combineResults[T]), Coalgebra(unfoldComparison[T]))
129129
.apply((Path.empty, writer.some, reader.some))
@@ -282,7 +282,7 @@ object Comparison extends ComparisonInstances {
282282
trait ComparisonInstances {
283283

284284
implicit def comparisonCatsFunctor[T] =
285-
new Functor[Comparison[T, ?]] {
285+
new Functor[Comparison[T, *]] {
286286
def map[A, B](fa: Comparison[T, A])(f: (A) => B): Comparison[T, B] =
287287
fa match {
288288
case Comparison.End(res) => Comparison.End(res)

src/main/scala/higherkindness/skeuomorph/mu/protocol.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ object Protocol {
8686
)
8787
}
8888

89-
def fromProtobufProto[T, U](compressionType: CompressionType, useIdiomaticEnpoints: Boolean = true)(
89+
def fromProtobufProto[T, U](compressionType: CompressionType, useIdiomaticEndpoints: Boolean = true)(
9090
protocol: protobuf.Protocol[T]
9191
)(implicit T: Basis[ProtobufF, T], U: Basis[MuF, U]): Protocol[U] = {
9292
val toMu: T => U = scheme.cata(transformProto[U].algebra)
@@ -113,7 +113,7 @@ object Protocol {
113113
SerializationType.Protobuf,
114114
compressionType,
115115
Option(protocol.pkg),
116-
useIdiomaticEnpoints,
116+
useIdiomaticEndpoints,
117117
s.operations.map(toOperation)
118118
)
119119
),

src/main/scala/higherkindness/skeuomorph/openapi/JsonDecoders.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object JsonDecoders {
3030
implicit def orReferenceDecoder[A: Decoder]: Decoder[Either[A, Reference]] =
3131
Decoder[Reference].map(_.asRight[A]) orElse Decoder[A].map(_.asLeft[Reference])
3232

33-
private def basicJsonSchemaDecoder[A: Embed[JsonSchemaF, ?]]: Decoder[A] = {
33+
private def basicJsonSchemaDecoder[A: Embed[JsonSchemaF, *]]: Decoder[A] = {
3434
import JsonSchemaF._
3535
Decoder.forProduct2[(String, Option[String]), String, Option[String]]("type", "format")(Tuple2.apply).emap {
3636
case ("integer", Some("int32")) => integer[A].embed.asRight
@@ -56,18 +56,18 @@ object JsonDecoders {
5656
case actual => DecodingFailure(s"$actual is not expected type $expected", c.history).asLeft
5757
}
5858

59-
private def enumJsonSchemaDecoder[A: Embed[JsonSchemaF, ?]]: Decoder[A] =
59+
private def enumJsonSchemaDecoder[A: Embed[JsonSchemaF, *]]: Decoder[A] =
6060
Decoder.instance(c =>
6161
for {
6262
values <- c.downField("enum").as[List[String]]
6363
_ <- validateType(c, "string")
6464
} yield JsonSchemaF.enum[A](values).embed
6565
)
6666

67-
private def sumJsonSchemaDecoder[A: Embed[JsonSchemaF, ?]]: Decoder[A] =
67+
private def sumJsonSchemaDecoder[A: Embed[JsonSchemaF, *]]: Decoder[A] =
6868
Decoder.instance(_.downField("oneOf").as[List[A]].map(JsonSchemaF.sum[A](_).embed))
6969

70-
private def objectJsonSchemaDecoder[A: Embed[JsonSchemaF, ?]]: Decoder[A] =
70+
private def objectJsonSchemaDecoder[A: Embed[JsonSchemaF, *]]: Decoder[A] =
7171
Decoder.instance { c =>
7272
def propertyExists(name: String): Decoder.Result[Unit] =
7373
c.downField(name)
@@ -92,18 +92,18 @@ object JsonDecoders {
9292
} yield JsonSchemaF.`object`[A](properties, required.getOrElse(List.empty)).embed
9393
}
9494

95-
private def arrayJsonSchemaDecoder[A: Embed[JsonSchemaF, ?]: Decoder]: Decoder[A] =
95+
private def arrayJsonSchemaDecoder[A: Embed[JsonSchemaF, *]: Decoder]: Decoder[A] =
9696
Decoder.instance { c =>
9797
for {
9898
items <- c.downField("items").as[A](jsonSchemaDecoder[A])
9999
_ <- validateType(c, "array")
100100
} yield JsonSchemaF.array(items).embed
101101
}
102102

103-
private def referenceJsonSchemaDecoder[A: Embed[JsonSchemaF, ?]]: Decoder[A] =
103+
private def referenceJsonSchemaDecoder[A: Embed[JsonSchemaF, *]]: Decoder[A] =
104104
Decoder[Reference].map(x => JsonSchemaF.reference[A](x.ref).embed)
105105

106-
implicit def jsonSchemaDecoder[A: Embed[JsonSchemaF, ?]]: Decoder[A] =
106+
implicit def jsonSchemaDecoder[A: Embed[JsonSchemaF, *]]: Decoder[A] =
107107
referenceJsonSchemaDecoder orElse
108108
sumJsonSchemaDecoder orElse
109109
objectJsonSchemaDecoder orElse

src/main/scala/higherkindness/skeuomorph/openapi/Optimize.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ object Optimize {
2929
case other => other
3030
}
3131

32-
def namedTypes[T: Basis[JsonSchemaF, ?]](name: String): T => T = scheme.cata(namedTypesTrans(name).algebra)
32+
def namedTypes[T: Basis[JsonSchemaF, *]](name: String): T => T = scheme.cata(namedTypesTrans(name).algebra)
3333

3434
type NestedTypesState[T, O] = State[(Map[String, T], Long), O]
3535

36-
def nestedTypesTrans[T: Basis[JsonSchemaF, ?]]: TransM[NestedTypesState[T, ?], JsonSchemaF, JsonSchemaF, T] =
36+
def nestedTypesTrans[T: Basis[JsonSchemaF, *]]: TransM[NestedTypesState[T, *], JsonSchemaF, JsonSchemaF, T] =
3737
TransM {
3838
case JsonSchemaF.ArrayF(x) if isNestedType(x) =>
3939
extractNestedTypes("AnonymousObject", x).map { case (n, t) => JsonSchemaF.ArrayF(namedTypes(n).apply(t)) }
4040

4141
case JsonSchemaF.ObjectF(fields, required) =>
4242
fields
43-
.traverse[NestedTypesState[T, ?], JsonSchemaF.Property[T]] {
43+
.traverse[NestedTypesState[T, *], JsonSchemaF.Property[T]] {
4444
case p if isNestedType(p.tpe) =>
4545
extractNestedTypes(p.name.capitalize, p.tpe).map { //TODO Maybe we should normalize
4646
case (n, t) => p.copy(tpe = namedTypes[T](n).apply(t))
@@ -52,10 +52,10 @@ object Optimize {
5252
case other => State.pure(other)
5353
}
5454

55-
def nestedTypes[T: Basis[JsonSchemaF, ?]]: T => NestedTypesState[T, T] =
55+
def nestedTypes[T: Basis[JsonSchemaF, *]]: T => NestedTypesState[T, T] =
5656
scheme.anaM(nestedTypesTrans.coalgebra)
5757

58-
private def isNestedType[T: Project[JsonSchemaF, ?]](t: T): Boolean = {
58+
private def isNestedType[T: Project[JsonSchemaF, *]](t: T): Boolean = {
5959
import JsonSchemaF._
6060
import higherkindness.droste.syntax.project.toProjectSyntaxOps
6161
t.project match {
@@ -65,7 +65,7 @@ object Optimize {
6565
}
6666
}
6767

68-
private def extractNestedTypes[T: Basis[JsonSchemaF, ?]](name: String, tpe: T): NestedTypesState[T, (String, T)] = {
68+
private def extractNestedTypes[T: Basis[JsonSchemaF, *]](name: String, tpe: T): NestedTypesState[T, (String, T)] = {
6969
def addType(items: (String, T)): NestedTypesState[T, Unit] =
7070
State.modify { case (x, y) =>
7171
(x + items) -> y

src/main/scala/higherkindness/skeuomorph/openapi/client/http4s/circe/package.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ package object circe {
4848
protected def isIdentifier: String => Boolean =
4949
field => field.headOption.exists(x => x.isLetter && x.isLower) && field.forall(_.isLetterOrDigit)
5050

51-
implicit def circeCodecsPrinter[T: Basis[JsonSchemaF, ?]]: Printer[Codecs] =
51+
implicit def circeCodecsPrinter[T: Basis[JsonSchemaF, *]]: Printer[Codecs] =
5252
(
5353
sepBy(space *< space *< importDef, "\n") >* newLine,
5454
optional(space *< space *< showEnum >* newLine),
@@ -102,7 +102,7 @@ package object circe {
102102

103103
}
104104

105-
implicit def http4sCodecsPrinter[T: Basis[JsonSchemaF, ?]]: Printer[EntityCodecs[T]] =
105+
implicit def http4sCodecsPrinter[T: Basis[JsonSchemaF, *]]: Printer[EntityCodecs[T]] =
106106
(
107107
sepBy(space *< space *< importDef, "\n") >* newLine,
108108
space *< space *< entityEncoder[T] >* newLine,
@@ -112,16 +112,16 @@ package object circe {
112112
(packages, y, y)
113113
}
114114

115-
private def decoderDef[T: Basis[JsonSchemaF, ?], B](body: Printer[B]): Printer[(String, Tpe[T], B)] =
115+
private def decoderDef[T: Basis[JsonSchemaF, *], B](body: Printer[B]): Printer[(String, Tpe[T], B)] =
116116
implicitVal(body).contramap { case (x, y, z) => (normalize(x), "Decoder", y, z) }
117117

118-
private def encoderDef[T: Basis[JsonSchemaF, ?], B](body: Printer[B]): Printer[(String, Tpe[T], B)] =
118+
private def encoderDef[T: Basis[JsonSchemaF, *], B](body: Printer[B]): Printer[(String, Tpe[T], B)] =
119119
implicitVal(body).contramap { case (x, y, z) => (normalize(x), "Encoder", y, z) }
120120

121-
def enumCirceEncoder[T: Basis[JsonSchemaF, ?], B]: Printer[String] =
121+
def enumCirceEncoder[T: Basis[JsonSchemaF, *], B]: Printer[String] =
122122
encoderDef(κ("Encoder.encodeString.contramap(_.show)")).contramap(x => (x, Tpe[T](x), ()))
123123

124-
def enumCirceDecoder[T: Basis[JsonSchemaF, ?], B]: Printer[(String, List[String])] =
124+
def enumCirceDecoder[T: Basis[JsonSchemaF, *], B]: Printer[(String, List[String])] =
125125
decoderDef[T, (String, List[String])](
126126
(
127127
κ("Decoder.decodeString.emap {") *< newLine *<
@@ -136,7 +136,7 @@ package object circe {
136136
(x, Tpe[T](x), x -> xs)
137137
}
138138

139-
def sumCirceEncoder[T: Basis[JsonSchemaF, ?], B]: Printer[(String, List[String])] = {
139+
def sumCirceEncoder[T: Basis[JsonSchemaF, *], B]: Printer[(String, List[String])] = {
140140
val polyObject: Printer[((String, Option[String]), List[PackageName], List[(String, String, String)])] = objectDef(
141141
sepBy(
142142
(
@@ -156,23 +156,23 @@ package object circe {
156156
}
157157
}
158158

159-
def sumCirceDecoder[T: Basis[JsonSchemaF, ?], B]: Printer[(String, List[String])] =
159+
def sumCirceDecoder[T: Basis[JsonSchemaF, *], B]: Printer[(String, List[String])] =
160160
decoderDef[T, (List[(String, String)])](
161161
sepBy(
162162
divBy(κ("Decoder[") *< string >* κ("]"), κ(".map(x => "), κ("Coproduct[") *< string >* κ("](x))")),
163163
" orElse "
164164
)
165165
).contramap { case (x, xs) => (x, Tpe[T](x), xs.map(_ -> x)) }
166166

167-
def circeDecoder[T: Basis[JsonSchemaF, ?]]: Printer[(String, Tpe[T])] =
167+
def circeDecoder[T: Basis[JsonSchemaF, *]]: Printer[(String, Tpe[T])] =
168168
decoderDef(κ("deriveDecoder[") *< tpe[T] >* κ("]"))
169169
.contramap(x => (x._1, x._2, x._2))
170170

171-
def circeEncoder[T: Basis[JsonSchemaF, ?]]: Printer[(String, Tpe[T])] =
171+
def circeEncoder[T: Basis[JsonSchemaF, *]]: Printer[(String, Tpe[T])] =
172172
encoderDef(κ("deriveEncoder[") *< tpe[T] >* κ("]"))
173173
.contramap(x => (x._1, x._2, x._2))
174174

175-
def forProductCirceEncoder[T: Basis[JsonSchemaF, ?]]: Printer[(String, Tpe[T], List[String])] =
175+
def forProductCirceEncoder[T: Basis[JsonSchemaF, *]]: Printer[(String, Tpe[T], List[String])] =
176176
encoderDef[T, List[String]](
177177
(
178178
κ("Encoder.forProduct") *< string >* κ("("),
@@ -181,7 +181,7 @@ package object circe {
181181
).contramapN(x => (x.length.toString, x, x.map(Var.apply)))
182182
).contramap(x => (x._1, x._2, x._3))
183183

184-
def forProductCirceDecoder[T: Basis[JsonSchemaF, ?]]: Printer[(String, Tpe[T], List[String])] =
184+
def forProductCirceDecoder[T: Basis[JsonSchemaF, *]]: Printer[(String, Tpe[T], List[String])] =
185185
decoderDef[T, (List[String], Tpe[T])](
186186
(
187187
κ("Decoder.forProduct") *< string >* κ("("),
@@ -190,21 +190,21 @@ package object circe {
190190
).contramapN(x => (x._1.length.toString, x._1, x._2))
191191
).contramap(x => (x._1, x._2, (x._3, x._2)))
192192

193-
def entityDecoder[T: Basis[JsonSchemaF, ?]]: Printer[(String, Tpe[T])] =
193+
def entityDecoder[T: Basis[JsonSchemaF, *]]: Printer[(String, Tpe[T])] =
194194
(
195195
κ("implicit def ") *< string >* κ("EntityDecoder[F[_]:Sync]: "),
196196
κ("EntityDecoder[F, ") *< tpe[T] >* κ("] = "),
197197
κ("jsonOf[F, ") *< tpe[T] >* κ("]")
198198
).contramapN(x => (normalize(x._1), x._2, x._2))
199199

200-
def entityEncoder[T: Basis[JsonSchemaF, ?]]: Printer[(String, Tpe[T])] =
200+
def entityEncoder[T: Basis[JsonSchemaF, *]]: Printer[(String, Tpe[T])] =
201201
(
202202
κ("implicit def ") *< string >* κ("EntityEncoder[F[_]:Applicative]: "),
203203
κ("EntityEncoder[F, ") *< tpe[T] >* κ("] = "),
204204
κ("jsonEncoderOf[F, ") *< tpe[T] >* κ("]")
205205
).contramapN(x => (normalize(x._1), x._2, x._2))
206206

207-
private def showEnum[T: Basis[JsonSchemaF, ?]]: Printer[((String, String), List[(String, String)])] =
207+
private def showEnum[T: Basis[JsonSchemaF, *]]: Printer[((String, String), List[(String, String)])] =
208208
divBy(
209209
implicitVal(κ("Show.show {")).contramap { case (x, y) => (normalize(x), "Show", Tpe[T](y), ()) },
210210
newLine,

0 commit comments

Comments
 (0)