remove small Scala 2.12 artifacts (#13618)

* remove unneeded type-param indirection with proper Scala support
* remove readFile; it is unused

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Stephen Compall 2022-04-20 11:48:54 -04:00 committed by GitHub
parent 6a570ea2ac
commit 1d1fbb10af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 22 deletions

View File

@ -366,14 +366,13 @@ sealed abstract class Queries(tablePrefix: String, tpIdCacheMaxEntries: Long)(im
}, },
fr" OR ", fr" OR ",
) )
// we effectively shadow Mark because Scala 2.12 doesn't quite get @nowarn("cat=unused&msg=MarkR in method goQuery.*is never used") // false negative
// that it should use the GADT type equality otherwise def goQuery(
def goQuery[Mark0: Read](
tpid: Fragment tpid: Fragment
): Query0[DBContract[Mark0, JsValue, JsValue, Vector[String]]] = { )(implicit MarkR: Read[Mark]): Query0[DBContract[Mark, JsValue, JsValue, Vector[String]]] = {
val q = query(tpid, queriesCondition) val q = query(tpid, queriesCondition)
q.query[ q.query[
(String, Mark0, Key, Option[String], JsValue, SigsObs, SigsObs, Agreement) (String, Mark, Key, Option[String], JsValue, SigsObs, SigsObs, Agreement)
].map { case (cid, tpid, rawKey, keyHash, payload, signatories, observers, rawAgreement) => ].map { case (cid, tpid, rawKey, keyHash, payload, signatories, observers, rawAgreement) =>
DBContract( DBContract(
contractId = cid, contractId = cid,
@ -391,9 +390,9 @@ sealed abstract class Queries(tablePrefix: String, tpIdCacheMaxEntries: Long)(im
trackMatchIndices match { trackMatchIndices match {
case MatchedQueryMarker.ByInt => case MatchedQueryMarker.ByInt =>
val tpid = projectedIndex(queries.zipWithIndex, tpidSelector = tpidSelector) val tpid = projectedIndex(queries.zipWithIndex, tpidSelector = tpidSelector)
goQuery[MatchedQueries](tpid) goQuery(tpid)
case MatchedQueryMarker.Unused => case MatchedQueryMarker.Unused =>
goQuery[SurrogateTpId](tpidSelector) goQuery(tpidSelector)
} }
} }

View File

@ -11,7 +11,6 @@ import akka.util.ByteString
import com.typesafe.scalalogging.LazyLogging import com.typesafe.scalalogging.LazyLogging
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
import scala.io.Source
import scala.util.{Failure, Success, Try, Using} import scala.util.{Failure, Success, Try, Using}
object TestUtil extends LazyLogging { object TestUtil extends LazyLogging {
@ -29,20 +28,6 @@ object TestUtil extends LazyLogging {
file file
} }
def readFile(resourcePath: String): String =
Try {
val source = Source.fromResource(resourcePath)
val content = source.getLines().mkString
source.close
content
} match {
case Success(value) => value
// only needed for Scala 2.12; 2.13 does this itself
case Failure(_: NullPointerException) =>
throw new java.io.FileNotFoundException(s"resource '$resourcePath' not found in classpath")
case Failure(ex) => throw ex
}
def getResponseDataBytes(resp: HttpResponse, debug: Boolean = false)(implicit def getResponseDataBytes(resp: HttpResponse, debug: Boolean = false)(implicit
mat: Materializer, mat: Materializer,
ec: ExecutionContext, ec: ExecutionContext,