Skip to content

Commit 31a563d

Browse files
committed
Remove multiple implicitly calls. Still getting: Pojo does not take parameters
1 parent 994a4c8 commit 31a563d

File tree

11 files changed

+138
-287
lines changed

11 files changed

+138
-287
lines changed

build.sbt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ inThisBuild(
55
Seq(
66
version := "0.1",
77
scalaVersion := "2.13.5",
8-
scalacOptions ++= "-Ymacro-annotations" :: "-language:experimental.macros" :: Nil
8+
scalacOptions ++= Seq(
9+
"-Ymacro-annotations",
10+
"-language:experimental.macros",
11+
//"-Xlog-implicits",
12+
"-Ymacro-debug-lite"
13+
),
14+
// for nicer error messages
15+
addCompilerPlugin("io.tryp" % "splain" % "0.5.8" cross CrossVersion.patch)
916
)
1017
)
1118

@@ -28,6 +35,7 @@ lazy val `scala-macros-usage` = (project in file("scala-macros-usage"))
2835
libraryDependencies ++= Seq(
2936
scalaPbRuntime,
3037
beamSdksJavaCore,
31-
beamRunnersDirectJava
38+
beamRunnersDirectJava,
39+
scalaTest
3240
)
3341
)

project/Dependencies.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ object Dependencies {
77
val beamVersion = "2.28.0"
88
val beamSdksJavaCore = "org.apache.beam" % "beam-sdks-java-core" % beamVersion
99
val beamRunnersDirectJava = "org.apache.beam" % "beam-runners-direct-java" % beamVersion % Runtime
10+
11+
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.7" % Test
1012
}

scala-macros-usage/src/main/scala/com/github/fpopic/scalamacros/AnnotationMacroUsage.scala

Lines changed: 0 additions & 23 deletions
This file was deleted.

scala-macros-usage/src/main/scala/com/github/fpopic/scalamacros/DefMacroCoderUsage.scala

Lines changed: 0 additions & 30 deletions
This file was deleted.

scala-macros-usage/src/main/scala/com/github/fpopic/scalamacros/DefMacroUsageCombinedWithIdentityAnnotation.scala

Lines changed: 0 additions & 31 deletions
This file was deleted.

scala-macros-usage/src/main/scala/com/github/fpopic/scalamacros/Person.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.github.fpopic.scalamacros.beam
2+
3+
import org.apache.beam.sdk.coders.Coder
4+
import org.scalatest.flatspec.AnyFlatSpec
5+
import org.scalatest.matchers.should.Matchers
6+
7+
import java.io.{ByteArrayInputStream, ByteArrayOutputStream}
8+
9+
case class Pojo(s: String, i: Int, l: List[Int])
10+
11+
class DefMacroCoderSpec extends AnyFlatSpec with Matchers {
12+
13+
behavior of "DefMacroCoder"
14+
15+
it should "generate a coder and serialize/deserialize properly the value." in {
16+
import DefMacroCoder.{intCoder, stringCoder, listCoder}
17+
val coder: Coder[Pojo] = DefMacroCoder.productCoder[Pojo]
18+
19+
val pojo = Pojo(s = "4", i = 1, l = List(2, 3))
20+
21+
val encoded: Array[Byte] = {
22+
val os = new ByteArrayOutputStream()
23+
coder.encode(pojo, os)
24+
os.toByteArray
25+
}
26+
val decoded: Pojo = coder.decode(new ByteArrayInputStream(encoded))
27+
28+
pojo shouldBe decoded
29+
}
30+
31+
}

scala-macros/src/main/scala/com/github/fpopic/scalamacros/AnnotationMacroIdentityExample.scala

Lines changed: 0 additions & 53 deletions
This file was deleted.

scala-macros/src/main/scala/com/github/fpopic/scalamacros/DefMacroToMapExample.scala

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)