Skip to content

Commit

Permalink
Merge branch 'master' into scala-native
Browse files Browse the repository at this point in the history
  • Loading branch information
sirthias authored Dec 5, 2024
2 parents a4f65be + 8bbaa66 commit 2e56b19
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 31 deletions.
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sbt.*
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}

def scala3 = "3.3.3"
def scala3 = "3.3.4"

inThisBuild(
List(
Expand Down Expand Up @@ -114,18 +114,18 @@ lazy val releaseSettings = {
/////////////////////// DEPENDENCIES /////////////////////////

// format: OFF
val `akka-actor` = Def.setting("com.typesafe.akka" %% "akka-actor-typed" % "2.8.6")
val `akka-stream` = Def.setting("com.typesafe.akka" %% "akka-stream" % "2.8.6")
val `akka-actor` = Def.setting("com.typesafe.akka" %% "akka-actor-typed" % "2.8.8")
val `akka-stream` = Def.setting("com.typesafe.akka" %% "akka-stream" % "2.8.8")
val `akka-http` = Def.setting("com.typesafe.akka" %% "akka-http" % "10.5.3")
val `pekko-actor` = Def.setting("org.apache.pekko" %% "pekko-actor-typed" % "1.1.1")
val `pekko-stream` = Def.setting("org.apache.pekko" %% "pekko-stream" % "1.1.1")
val `pekko-http` = Def.setting("org.apache.pekko" %% "pekko-http" % "1.0.1")
val `pekko-actor` = Def.setting("org.apache.pekko" %% "pekko-actor-typed" % "1.1.2")
val `pekko-stream` = Def.setting("org.apache.pekko" %% "pekko-stream" % "1.1.2")
val `pekko-http` = Def.setting("org.apache.pekko" %% "pekko-http" % "1.1.0")
val `cats-core` = Def.setting("org.typelevel" %%% "cats-core" % "2.12.0")
val `circe-core` = Def.setting("io.circe" %%% "circe-core" % "0.14.10")
val `circe-parser` = Def.setting("io.circe" %%% "circe-parser" % "0.14.10")
val `circe-generic` = Def.setting("io.circe" %%% "circe-generic" % "0.14.10")
val `scodec-bits` = Def.setting("org.scodec" %%% "scodec-bits" % "1.2.1")
val munit = Def.setting("org.scalameta" %%% "munit" % "1.0.2" % Test)
val munit = Def.setting("org.scalameta" %%% "munit" % "1.0.3" % Test)
val macrolizer = Def.setting("io.bullet" %%% "macrolizer" % "0.6.2" % "compile-internal, test-internal")
// format: ON

Expand Down
18 changes: 6 additions & 12 deletions core/src/main/scala/io/bullet/borer/Decoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,14 @@

package io.bullet.borer

import java.lang.{
Boolean as JBoolean,
Byte as JByte,
Double as JDouble,
Float as JFloat,
Long as JLong,
Short as JShort
}
import java.math.{BigDecimal as JBigDecimal, BigInteger as JBigInteger}
import io.bullet.borer.encodings.BaseEncoding
import io.bullet.borer.internal.Util

import scala.annotation.{tailrec, threadUnsafe}
import scala.collection.immutable.{HashMap, ListMap, TreeMap}
import java.lang.{Boolean as JBoolean, Byte as JByte, Double as JDouble, Float as JFloat, Long as JLong, Short as JShort}
import java.math.{BigDecimal as JBigDecimal, BigInteger as JBigInteger}
import scala.annotation.{nowarn, tailrec, threadUnsafe}
import scala.collection.{mutable, Factory}
import scala.collection.immutable.{HashMap, ListMap, TreeMap}
import scala.deriving.Mirror
import scala.reflect.ClassTag

Expand All @@ -33,7 +26,7 @@ trait Decoder[T]:
def read(r: Reader): T

object Decoder extends LowPrioDecoders:
import io.bullet.borer.{DataItem => DI}
import io.bullet.borer.DataItem as DI

/**
* A [[Decoder]] that might change its encoding strategy if [[T]] has a default value.
Expand Down Expand Up @@ -88,6 +81,7 @@ object Decoder extends LowPrioDecoders:
* Maps the result of the underlying [[Decoder]] with the given function.
* If the function returns `None` decoding will fail with a [[Borer.Error.ValidationFailure]].
*/
@nowarn("msg=anonymous class definition will be duplicated at each inline site")
inline def mapOption[B: Mirror.Of](f: A => Option[B]): Decoder[B] =
Decoder(r => f(underlying.read(r)).getOrElse(r.unexpectedDataItem(Util.typeName[B])))

Expand Down
10 changes: 2 additions & 8 deletions core/src/main/scala/io/bullet/borer/Input.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@

package io.bullet.borer

import io.bullet.borer.input.{
FromByteArrayInput,
FromByteBufferInput,
FromFileInput,
FromInputStreamInput,
FromIteratorInput
}
import io.bullet.borer.input.*

/**
* Mutable abstraction wrapping some source of bytes to serve as parser input.
Expand All @@ -36,7 +30,7 @@ trait Input[Bytes]:
* So any input will never have to cache more that the last 255 bytes from the head of the input.
*
* Also: Decoding CBOR never needs unreading, so if your use case doesn't have to support JSON
* then it's file to simply "implement" this method with `???`.
* then it's fine to simply "implement" this method with `???`.
*/
def unread(numberOfBytes: Int): this.type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package io.bullet.borer.encodings

abstract class LookupBaseEncoding(_name: String, _bitsPerChar: Int, alphabet: String)
abstract class LookupBaseEncoding(_name: String, _bitsPerChar: Int, val alphabet: String)
extends BaseEncoding(_name, _bitsPerChar):

protected val alphabetChars = alphabet.toCharArray
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ package io.bullet.borer.internal

import io.bullet.borer.*

import scala.deriving.*
import scala.compiletime.*
import scala.deriving.*
import scala.Tuple.Size
import scala.annotation.nowarn

private[borer] object BasicProductCodec:

@nowarn("msg=anonymous class definition will be duplicated at each inline site")
inline def encoder[T <: Product](using m: Mirror.ProductOf[T]): Encoder[T] =
type Fields = m.MirroredElemTypes
inline erasedValue[Fields] match
Expand All @@ -32,6 +34,7 @@ private[borer] object BasicProductCodec:
case _: (t *: ts) =>
encRec[T, ts](w.write(x.productElement(n).asInstanceOf[t])(using summonInline[Encoder[t]]), x, n + 1)

@nowarn("msg=anonymous class definition will be duplicated at each inline site")
inline def decoder[T <: Product](using m: Mirror.ProductOf[T]): Decoder[T] =
type Fields = m.MirroredElemTypes
inline erasedValue[Fields] match
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.2
sbt.version=1.10.6
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.2")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("com.github.sbt" % "sbt-boilerplate" % "0.7.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
Expand Down

0 comments on commit 2e56b19

Please sign in to comment.