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

Trait pattern quasiquote might not match interface traits without mods #8399

Closed
scabug opened this issue Mar 12, 2014 · 4 comments
Closed

Trait pattern quasiquote might not match interface traits without mods #8399

scabug opened this issue Mar 12, 2014 · 4 comments

Comments

@scabug
Copy link

scabug commented Mar 12, 2014

scala> val q"trait X { ..$stats }" = q"trait X { def x: Int }"
scala.MatchError: abstract trait X extends scala.AnyRef {
  def x: Int
} (of class scala.reflect.internal.Trees$ClassDef)
  ... 32 elided

Caused by the fact that interface trait has one extra INTERFACE flag which is not expected by the structure of the trait pattern on the left.

@scabug
Copy link
Author

scabug commented Mar 12, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8399?orig=1
Reporter: @densh
Affected Versions: 2.11.0-RC1

@scabug
Copy link
Author

scabug commented Apr 1, 2014

@densh said:
Workaround: always extract modifiers even if they are not used:

scala> val q"$_ trait $name { ..$stats }" = q"trait X { def x: Int }"
name: reflect.runtime.universe.TypeName = X
stats: List[reflect.runtime.universe.Tree] = List(def x: Int)

@scabug
Copy link
Author

scabug commented Apr 1, 2014

@densh said (edited on Apr 4, 2014 10:35:16 AM UTC):
Note to self: don't forget to update the docs before closing this issue.

@SethTisue
Copy link
Member

closing all quasiquotes tickets; see #10755

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants