Skip to content

Commit

Permalink
Merge pull request #1000 from fthomas/topic/merge-master-into-0.10
Browse files Browse the repository at this point in the history
Merge master into series/0.10
  • Loading branch information
fthomas authored Jul 27, 2021
2 parents 1263368 + 30d667e commit 6816861
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 150 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['*']
branches: ['**']
push:
branches: ['*']
branches: ['**']
tags: [v*]

env:
Expand All @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.13, 2.13.5, 3.0.0]
scala: [2.12.14, 2.13.6, 3.0.1]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -33,7 +33,7 @@ jobs:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v10
uses: olafurpg/setup-scala@v12
with:
java-version: ${{ matrix.java }}

Expand All @@ -50,21 +50,21 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck'

- name: Build project (Scala 2)
if: matrix.scala == '2.12.13' || matrix.scala == '2.13.5'
run: sbt ++${{ matrix.scala }} validateJVM validateJS
if: matrix.scala == '2.12.14' || matrix.scala == '2.13.6'
run: sbt --client '++${{ matrix.scala }}; validateJVM; validateJS'

- name: Build project (Scala 3)
if: matrix.scala == '3.0.0'
run: sbt ++${{ matrix.scala }} validateJVM30 validateJS30
if: matrix.scala == '3.0.1'
run: sbt --client '++${{ matrix.scala }}; validateJVM30; validateJS30'

- name: Codecov
uses: codecov/codecov-action@v1

- name: Compress target directories
run: tar cf targets.tar modules/jsonpath/jvm/target modules/shapeless/js/target target modules/docs/target modules/pureconfig/jvm/target modules/core/js/target modules/core/jvm/target modules/scodec/jvm/target modules/scodec/js/target modules/shapeless/jvm/target modules/cats/js/target modules/cats/jvm/target modules/eval/jvm/target modules/scopt/jvm/target modules/scalaz/jvm/target modules/scalacheck/jvm/target modules/scalacheck/js/target modules/benchmark/target project/target
run: tar cf targets.tar modules/jsonpath/jvm/target modules/shapeless/js/target target modules/scalaxml/jvm/target modules/docs/target modules/pureconfig/jvm/target modules/core/js/target modules/core/jvm/target modules/scodec/jvm/target modules/scodec/js/target modules/shapeless/jvm/target modules/cats/js/target modules/cats/jvm/target modules/eval/jvm/target modules/scopt/jvm/target modules/scalaz/jvm/target modules/scalacheck/jvm/target modules/scalacheck/js/target modules/benchmark/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
Expand All @@ -79,7 +79,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.13]
scala: [2.12.14]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -89,7 +89,7 @@ jobs:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v10
uses: olafurpg/setup-scala@v12
with:
java-version: ${{ matrix.java }}

Expand All @@ -105,32 +105,32 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.12.13)
- name: Download target directories (2.12.14)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.12.13-${{ matrix.java }}
name: target-${{ matrix.os }}-2.12.14-${{ matrix.java }}

- name: Inflate target directories (2.12.13)
- name: Inflate target directories (2.12.14)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.5)
- name: Download target directories (2.13.6)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.5-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.6-${{ matrix.java }}

- name: Inflate target directories (2.13.5)
- name: Inflate target directories (2.13.6)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.0.0)
- name: Download target directories (3.0.1)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.0.0-${{ matrix.java }}
name: target-${{ matrix.os }}-3.0.1-${{ matrix.java }}

- name: Inflate target directories (3.0.0)
- name: Inflate target directories (3.0.1)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
6 changes: 3 additions & 3 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ pull_request_rules:
- name: automatically merge scala-steward's PRs
conditions:
- author=scala-steward
- status-success=Build and Test (ubuntu-latest, 2.12.13, [email protected])
- status-success=Build and Test (ubuntu-latest, 2.13.5, [email protected])
- status-success=Build and Test (ubuntu-latest, 3.0.0, [email protected])
- status-success=Build and Test (ubuntu-latest, 2.12.14, [email protected])
- status-success=Build and Test (ubuntu-latest, 2.13.6, [email protected])
- status-success=Build and Test (ubuntu-latest, 3.0.1, [email protected])
- body~=labels:.*semver-patch
actions:
merge:
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/fthomas/refined/Continuous%20Integration)](https://github.com/fthomas/refined/actions?query=workflow%3A%22Continuous+Integration%22)
[![codecov.io](https://img.shields.io/codecov/c/github/fthomas/refined.svg)](http://codecov.io/github/fthomas/refined)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/fthomas/refined?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Scaladex](https://index.scala-lang.org/fthomas/refined/refined/latest.svg?color=blue)](https://index.scala-lang.org/fthomas/refined/refined)
[![Scaladoc](https://www.javadoc.io/badge/eu.timepit/refined_2.12.svg?color=blue&label=Scaladoc)](https://javadoc.io/doc/eu.timepit/refined_2.12/0.9.25)
[![refined Scala version support](https://index.scala-lang.org/fthomas/refined/refined/latest-by-scala-version.svg?color=blue)](https://index.scala-lang.org/fthomas/refined/refined)
[![Scaladoc](https://www.javadoc.io/badge/eu.timepit/refined_2.12.svg?color=blue&label=Scaladoc)](https://javadoc.io/doc/eu.timepit/refined_2.12/0.9.27)

**refined** is a Scala library for refining types with type-level predicates
which constrain the set of values described by the refined type.
Expand Down Expand Up @@ -89,7 +89,7 @@ scala> val b: Int Refined Greater[W.`4`.T] = a
b: Int Refined Greater[Int(4)] = 10
```

**Note** that [`W`](https://static.javadoc.io/eu.timepit/refined_2.12/0.9.25/eu/timepit/refined/index.html#W:shapeless.Witness.type)
**Note** that [`W`](https://static.javadoc.io/eu.timepit/refined_2.12/0.9.27/eu/timepit/refined/index.html#W:shapeless.Witness.type)
is a shortcut for [`shapeless.Witness`][singleton-types] which provides
syntax for [literal-based singleton types][sip-23].

Expand Down Expand Up @@ -187,31 +187,31 @@ ageEither2: Either[String,Age] = Right(55)

## Using refined

The latest version of the library is 0.9.25, which is available for Scala and
The latest version of the library is 0.9.27, which is available for Scala and
[Scala.js][scala.js] version 2.12 and 2.13.

If you're using sbt, add the following to your build:

```sbt
libraryDependencies ++= Seq(
"eu.timepit" %% "refined" % "0.9.25",
"eu.timepit" %% "refined-cats" % "0.9.25", // optional
"eu.timepit" %% "refined-eval" % "0.9.25", // optional, JVM-only
"eu.timepit" %% "refined-jsonpath" % "0.9.25", // optional, JVM-only
"eu.timepit" %% "refined-pureconfig" % "0.9.25", // optional, JVM-only
"eu.timepit" %% "refined-scalacheck" % "0.9.25", // optional
"eu.timepit" %% "refined-scalaz" % "0.9.25", // optional
"eu.timepit" %% "refined-scodec" % "0.9.25", // optional
"eu.timepit" %% "refined-scopt" % "0.9.25", // optional
"eu.timepit" %% "refined-shapeless" % "0.9.25" // optional
"eu.timepit" %% "refined" % "0.9.27",
"eu.timepit" %% "refined-cats" % "0.9.27", // optional
"eu.timepit" %% "refined-eval" % "0.9.27", // optional, JVM-only
"eu.timepit" %% "refined-jsonpath" % "0.9.27", // optional, JVM-only
"eu.timepit" %% "refined-pureconfig" % "0.9.27", // optional, JVM-only
"eu.timepit" %% "refined-scalacheck" % "0.9.27", // optional
"eu.timepit" %% "refined-scalaz" % "0.9.27", // optional
"eu.timepit" %% "refined-scodec" % "0.9.27", // optional
"eu.timepit" %% "refined-scopt" % "0.9.27", // optional
"eu.timepit" %% "refined-shapeless" % "0.9.27" // optional
)
```

For Scala.js just replace `%%` with `%%%` above.

Instructions for Maven and other build tools are available at [search.maven.org][search.maven].

Release notes for the latest version are [here](https://github.com/fthomas/refined/releases/tag/v0.9.25).
Release notes for the latest version are [here](https://github.com/fthomas/refined/releases/tag/v0.9.27).

## Community

Expand Down Expand Up @@ -308,7 +308,7 @@ opening a pull request to list it here:
## Documentation

API documentation of the latest release is available at:
<https://static.javadoc.io/eu.timepit/refined_2.12/0.9.25/eu/timepit/refined/index.html>
<https://static.javadoc.io/eu.timepit/refined_2.12/0.9.27/eu/timepit/refined/index.html>

There are further (type-checked) examples in the [`docs`][docs]
directory including ones for defining [custom predicates][custom-pred]
Expand Down
69 changes: 30 additions & 39 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ val gitHubOwner = "fthomas"
val gitPubUrl = s"https://github.com/$gitHubOwner/$projectName.git"
val gitDevUrl = s"[email protected]:$gitHubOwner/$projectName.git"

val Scala_2_12 = "2.12.13"
val Scala_2_13 = "2.13.5"
val Scala_3 = "3.0.0"
val Scala_2_12 = "2.12.14"
val Scala_2_13 = "2.13.6"
val Scala_3 = "3.0.1"

val catsVersion = "2.6.1"
val jsonpathVersion = "2.4.0"
val jsonpathVersion = "2.6.0"
val macroParadiseVersion = "2.1.1"
val pureconfigVersion = "0.15.0"
val pureconfigVersion = "0.16.0"
val shapelessVersion = "2.3.7"
val scalaCheckVersion = "1.15.4"
val scalaXmlVersion = "2.0.0"
val scalazVersion = "7.3.3"
val scalazVersion = "7.3.4"
val scodecVersion = "1.11.8"
val scoptVersion = "4.0.1"

Expand Down Expand Up @@ -290,7 +290,8 @@ lazy val shapelessJS = shapeless.js
lazy val scalaxml = myCrossProject("scalaxml")
.dependsOn(core % "compile->compile;test->test")
.settings(
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % scalaXmlVersion
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % scalaXmlVersion,
libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % "always"
)

lazy val scalaxmlJVM = scalaxml.jvm
Expand Down Expand Up @@ -364,39 +365,29 @@ def moduleJvmSettings(name: String): Seq[Def.Setting[_]] =
},
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters.exclude
Seq(
ProblemFilters.exclude[DirectMissingMethodProblem](
"eu.timepit.refined.api.RefType.unsafeWrapM"
),
ProblemFilters.exclude[DirectMissingMethodProblem](
"eu.timepit.refined.api.RefType.unsafeRewrapM"
),
ProblemFilters.exclude[DirectMissingMethodProblem](
"eu.timepit.refined.api.RefType.refineMF"
),
ProblemFilters.exclude[MissingClassProblem](
"eu.timepit.refined.internal.RefineMFullyApplied"
),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$ConstructorNames"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$ConstructorNames$"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$FieldNames"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$FieldNames$"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$Subtype"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$Subtype$"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$Supertype"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.generic$Supertype$"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.string$Xml$"),
ProblemFilters.exclude[MissingClassProblem]("eu.timepit.refined.string$Xml"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"eu.timepit.refined.predicates.StringPredicates.Xml"
),
ProblemFilters.exclude[DirectMissingMethodProblem]("eu.timepit.refined.predicates.all.Xml"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"eu.timepit.refined.predicates.string.Xml"
),
ProblemFilters.exclude[DirectMissingMethodProblem]("eu.timepit.refined.util.string.xml"),
ProblemFilters.exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.Max.findValid"),
ProblemFilters.exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.Min.findValid")
exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.Max.findValid"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.Min.findValid"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.RefType.unsafeWrapM"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.RefType.unsafeRewrapM"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.api.RefType.refineMF"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.predicates.StringPredicates.Xml"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.predicates.all.Xml"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.predicates.string.Xml"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.string.xmlNonEmptyInference"),
exclude[DirectMissingMethodProblem]("eu.timepit.refined.util.string.xml"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$ConstructorNames"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$ConstructorNames$"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$FieldNames"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$FieldNames$"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$Subtype"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$Subtype$"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$Supertype"),
exclude[MissingClassProblem]("eu.timepit.refined.generic$Supertype$"),
exclude[MissingClassProblem]("eu.timepit.refined.internal.RefineMFullyApplied"),
exclude[MissingClassProblem]("eu.timepit.refined.string$Xml$"),
exclude[MissingClassProblem]("eu.timepit.refined.string$Xml")
)
}
)
Expand Down
8 changes: 6 additions & 2 deletions latestVersion.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ ThisBuild / bincompatVersions := Map(
"0.9.22",
"0.9.23",
"0.9.24",
"0.9.25"
"0.9.25",
"0.9.26",
"0.9.27"
// NEXT_VERSION
),
"2.13" -> Set(
Expand All @@ -41,7 +43,9 @@ ThisBuild / bincompatVersions := Map(
"0.9.22",
"0.9.23",
"0.9.24",
"0.9.25"
"0.9.25",
"0.9.26",
"0.9.27"
// NEXT_VERSION
)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package eu.timepit.refined.api

opaque type Refined[T, P] = T
infix opaque type Refined[T, P] = T

object Refined {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ object boolean extends BooleanInference0 {
final case class Not[P](p: P)

/** Conjunction of the predicates `A` and `B`. */
final case class And[A, B](a: A, b: B)
infix final case class And[A, B](a: A, b: B)

/** Disjunction of the predicates `A` and `B`. */
final case class Or[A, B](a: A, b: B)
infix final case class Or[A, B](a: A, b: B)

/** Exclusive disjunction of the predicates `A` and `B`. */
final case class Xor[A, B](a: A, b: B)
infix final case class Xor[A, B](a: A, b: B)

/** Conjunction of all predicates in `PS`. */
final case class AllOf[PS](ps: PS)
Expand All @@ -37,10 +37,10 @@ object boolean extends BooleanInference0 {
final case class OneOf[PS](ps: PS)

/** Negated conjunction of the predicates `A` and `B`. */
type Nand[A, B] = Not[A And B]
infix type Nand[A, B] = Not[A And B]

/** Negated disjunction of the predicates `A` and `B`. */
type Nor[A, B] = Not[A Or B]
infix type Nor[A, B] = Not[A Or B]

object True {
implicit def trueValidate[T]: Validate.Plain[T, True] =
Expand Down Expand Up @@ -282,11 +282,23 @@ private[refined] trait BooleanInference1 extends BooleanInference2 {
p1.adapt("modusTollens(%s)")
}

private[refined] trait BooleanInference2 {
private[refined] trait BooleanInference2 extends BooleanInference3 {

implicit def conjunctionEliminationL[A, B, C](implicit p1: A ==> C): (A And B) ==> C =
p1.adapt("conjunctionEliminationL(%s)")

implicit def hypotheticalSyllogism[A, B, C](implicit p1: A ==> B, p2: B ==> C): A ==> C =
Inference.combine(p1, p2, "hypotheticalSyllogism(%s, %s)")
}

private[refined] trait BooleanInference3 {

implicit def substitutionInConjunction[A, B, C](implicit p1: B ==> C): (A And B) ==> (A And C) =
p1.adapt("substitutionInConjunction(%s)")

implicit def disjunctionTautologyElimination[A, B, C](implicit
p1: A ==> C,
p2: B ==> C
): (A Or B) ==> C =
Inference.combine(p1, p2, "disjunctionElimination")
}
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@ private[refined] trait StringInference {
implicit def validBigDecimalNonEmptyInference: ValidBigDecimal ==> NonEmpty =
Inference.alwaysValid("validBigDecimalNonEmptyInference")

implicit def xmlNonEmptyInference: Xml ==> NonEmpty =
Inference.alwaysValid("xmlNonEmptyInference")

implicit def xPathNonEmptyInference: XPath ==> NonEmpty =
Inference.alwaysValid("xPathNonEmptyInference")
}
Loading

0 comments on commit 6816861

Please sign in to comment.