Vampire Methods
ScalaSyd
Kittens!
Generate a loca
l class!
Paradise plugin
Just for q
uasi-quotes
Local CatMatcher
http://stackoverflow.com/questions/18480707/method-cannot-be-accessed-in-macro-generated-class
Don’t forg
et the {}!
Real incremental recompilation
Grab the Cat
TypeTag not acc
essible in
a macro
!
Inception matcher
Builder pattern
Matcher methods
// CatMatcher
Inception matcher
Cat matcher
Internal state
Inception matcher
new constraint =>new matcher function
name/age/kitten methods
list of c.Expr[_]
Mirror, mirror
structu
ral type =
>
reflection :-(
// age
// matchA[Cat].age(6)
// Int
Yo, I heard you like macros
No stru
ctural ty
pe!
Yo, I heard you like macros
Annotation code
// @fieldMatcherBody(expected => cat.age must_== expected)
// val expected = 6
// cat.age must_== expected
Yo, I heard you like macros
extract parameter/body
Transformers
// 6
// `prefix` represents an equivalent of // `this` for normal instance methods
// body:// CatMatcher.this.addMatcher((_:Cat).age must_== arg)
Transformers
http://stackoverflow.com/questions/18523871/use-this-in-a-generated-macro-method
Transformers -Yrangepos
Can you do this?
YES !!!
Thank you!
If you followed that far…