Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make extraction of repetitive code patterns easier in quasiquotes #8164

scabug opened this issue Jan 20, 2014 · 2 comments


Copy link

commented Jan 20, 2014

It'd be great to have support for matching over repetitive patterns in trees:

val q"def foo(..{$names: $tpes = $defaults})" = q"def foo(x: X, y: Y = Y(0))"
// names    == List(TermName("x"), TermName("y"))
// tpes     == List(tq"X", tq"Y")
// defaults == List(q"", q"Y(0)")

Currently one has to write:

val q"def foo(..$params)" = q"def foo(x: X, y: Y = Y(0))"
val names    = { case q"$_ val $name: $_   = $_"       => name    }
val tpes     = { case q"$_ val $_   : $tpe = $_"       => tpe     }    
val defaults = { case q"$_ val $_   : $_   = $default" => default }

This comment has been minimized.

Copy link

commented Jan 20, 2014

@scabug scabug added the enhancement label Apr 7, 2017

@scabug scabug added this to the Backlog milestone Apr 7, 2017


This comment has been minimized.

Copy link

commented Mar 1, 2018

closing all quasiquotes tickets; see #10755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.