Skip to content

fix #1748: desugaring with StringContext in PatDef #1749

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

Merged
merged 2 commits into from
Nov 28, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,8 @@ object desugar {
collect(tree)
case Tuple(trees) =>
trees foreach collect
case Thicket(trees) =>
trees foreach collect
case _ =>
}
collect(tree)
Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i1784.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
object Test {
implicit class Foo(sc: StringContext) {
object q {
def unapply(args: Any*): Option[(Any, Any)] =
Some((sc.parts(0), sc.parts(1)))
}
}

def f(defn: Any): Any = {
val q"class $name extends $parent" = defn
println(name)
println(parent)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should be a run-test instead since you're printing things? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree, it's better to be able to actually run it.