Skip to content

PatDef desugaring problem #1773

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

Closed
liufengyun opened this issue Dec 5, 2016 · 4 comments
Closed

PatDef desugaring problem #1773

liufengyun opened this issue Dec 5, 2016 · 4 comments

Comments

@liufengyun
Copy link
Contributor

Following code compiles fine in scalac but failed to compile in dotty. The cause is mostly like to be unmatched cases when desugaring patdef, as in #1748 .

object Test {
  implicit class Foo(sc: StringContext) {
    object q {
      def unapply(arg: Any): Option[(Any, Any)] =
        Some((sc.parts(0), sc.parts(1)))
    }
  }

  def main(args: Array[String]): Unit = {
    val q"class ${name: String} extends ${parent: String}" = new Object
    println(name)
    println(parent)
  }
}
@DarkDimius
Copy link
Contributor

DarkDimius commented Dec 5, 2016 via email

@DarkDimius
Copy link
Contributor

DarkDimius commented Dec 5, 2016 via email

@liufengyun
Copy link
Contributor Author

@DarkDimius it seems that adding a case for Block in Desugar#getVariables fix the problem, though there's another problem in RefChecks.

liufengyun added a commit to dotty-staging/dotty that referenced this issue Dec 7, 2016
liufengyun added a commit to dotty-staging/dotty that referenced this issue Dec 7, 2016
@liufengyun liufengyun self-assigned this Dec 7, 2016
liufengyun added a commit to dotty-staging/dotty that referenced this issue Dec 8, 2016
liufengyun added a commit that referenced this issue Dec 8, 2016
Fix #1773: handle patterns in interpolated string
@xeno-by
Copy link

xeno-by commented Dec 12, 2016

@liufengyun What's the problem with RefChecks that you were referring to in the last comment?

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

No branches or pull requests

3 participants