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

Output of for comprehensions #1051

Closed
etorreborre opened this issue Jul 26, 2017 · 3 comments
Closed

Output of for comprehensions #1051

etorreborre opened this issue Jul 26, 2017 · 3 comments

Comments

@etorreborre
Copy link

etorreborre commented Jul 26, 2017

Given the following macro annotation

class identity extends StaticAnnotation {

  inline def apply(defn: Any): Any = meta {
    defn
  }

}

and this code using it

@identity
case class K() {

  def test: List[Int] = {
    for {
      a <- List(1)
      x = 1
    } yield a + x
  }

}

I expect the exact same code to be present in the rewritten class but when I compile I get

[error] <macro>:5: missing parameter type for expanded function ((x$1: <error>) => x$1: @scala.unchecked)
[error]   }).map((_: @scala.unchecked()) match {
[error]           ^
[error] <macro>:6: constructor cannot be instantiated to expected type;
[error]  found   : (T1, T2)
[error]  required: <error> => <error> @unchecked
[error]     case (a, x) =>

This is using scalameta 1.8.0 and scala 2.12.2 (same thing for 1.9.0-834-25e73d6d).

@fommil
Copy link

fommil commented Jul 26, 2017

I think this is a dupe of one I encountered recently.

@etorreborre
Copy link
Author

I seems to have similar issue with pattern matched values:

for {
  x <- List(1)
  (y, z) <- List((2, 3))
} yield x + y + z

@xeno-by
Copy link
Member

xeno-by commented Sep 1, 2017

Resubmitted as https://github.com/scalameta/paradise/issues/223.

@xeno-by xeno-by closed this as completed Sep 1, 2017
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