Skip to content

Commit

Permalink
add explicit type
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Sep 10, 2023
1 parent 10fdec7 commit 4c5743b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions argonaut-jawn/shared/src/main/scala/argonaut/JawnParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ object JawnParser extends SupportParser[Json] {
def jnum(s: CharSequence, decIndex: Int, expIndex: Int) = Json.jNumber(JsonNumber.unsafeDecimal(s.toString))
def jstring(s: CharSequence) = Json.jString(s.toString)

def singleContext() = new FContext.NoIndexFContext[Json] {
def singleContext(): FContext[Json] = new FContext.NoIndexFContext[Json] {
var value: Json = null
def add(s: CharSequence) = { value = jstring(s.toString) }
def add(v: Json) = { value = v }
def finish(): Json = value
def isObj: Boolean = false
}

def arrayContext() = new FContext.NoIndexFContext[Json] {
def arrayContext(): FContext[Json] = new FContext.NoIndexFContext[Json] {
val vs = mutable.ListBuffer.empty[Json]
def add(s: CharSequence) = { vs += jstring(s.toString) }
def add(v: Json) = { vs += v }
def finish(): Json = Json.jArray(vs.toList)
def isObj: Boolean = false
}

def objectContext() = new FContext.NoIndexFContext[Json] {
def objectContext(): FContext[Json] = new FContext.NoIndexFContext[Json] {
var key: String = null
var vs = JsonObject.empty
def add(s: CharSequence): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object JsonObjectMonocle extends JsonObjectMonocles

trait JsonObjectMonocles {
implicit val jObjectEach: Each[JsonObject, Json] = new Each[JsonObject, Json]{
def each = new Traversal[JsonObject, Json]{
def each: Traversal[JsonObject, Json] = new Traversal[JsonObject, Json]{
def modifyA[F[_]: Applicative](f: Json => F[Json])(from: JsonObject): F[JsonObject] = {
JsonObjectCats.traverse(from, f)
}
Expand All @@ -26,7 +26,7 @@ trait JsonObjectMonocles {
}

implicit val jObjectFilterIndex: FilterIndex[JsonObject, JsonField, Json] = new FilterIndex[JsonObject, JsonField, Json]{
def filterIndex(predicate: JsonField => Boolean) = new Traversal[JsonObject, Json]{
def filterIndex(predicate: JsonField => Boolean): Traversal[JsonObject, Json] = new Traversal[JsonObject, Json]{
def modifyA[F[_]: Applicative](f: Json => F[Json])(from: JsonObject): F[JsonObject] =
Applicative[F].map(
from.toList.traverse[F, (JsonField, Json)]{ case (field, json) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package argonaut

import argonaut.JsonFilesSpecBase.TestData
import java.io.File
import scala.io.Source

object JsonFilesSpecification extends JsonFilesSpecBase {
override def testData = {
override def testData: Seq[TestData] = {
val files = new File(baseDir).listFiles.toList
files.map{ file =>
TestData(
Expand Down
2 changes: 1 addition & 1 deletion argonaut/shared/src/main/scala/argonaut/Context.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sealed abstract class Context {
object Context extends Contexts {
def empty: Context =
new Context {
val toList = Nil
val toList: List[ContextElement] = Nil
}
}

Expand Down

0 comments on commit 4c5743b

Please sign in to comment.