Skip to content

Instantly share code, notes, and snippets.

@ajrnz
Created February 28, 2021 11:21
Show Gist options
  • Save ajrnz/7f6ad6975d2221c58319da3ddd71124f to your computer and use it in GitHub Desktop.
Save ajrnz/7f6ad6975d2221c58319da3ddd71124f to your computer and use it in GitHub Desktop.
Macro Testing
package ajr.scala3test
import upickle.default.{macroRW, readwriter, ReadWriter => RW, Writer}
abstract class MyObject:
val ref: String
inline def macroCall(inline args: Any*): String = ${ callImpl('this, 'args) }
class Thing(val ref: String) extends MyObject:
def something(i: Int, d: Double, s: String) = macroCall(i: Int, d: Double, s: String) // Why do I need the types here?
object TestApp:
def main(args: Array[String]): Unit =
val res = Thing("aref").something(3, 3.14, "pi")
println(s"res=$res")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment