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

macros: paying the hardcoding piper #6516

Closed
scabug opened this issue Oct 11, 2012 · 6 comments
Closed

macros: paying the hardcoding piper #6516

scabug opened this issue Oct 11, 2012 · 6 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Oct 11, 2012

I haven't looked at the cause of this, but it feels like it can only be due to hardcoded handling of "Context" and "PrefixType" somewhere.

import scala.language.experimental.macros
import scala.reflect.macros.Context
import scala.collection.TraversableLike

// This one compiles
object Test {
  type Alias[T, CC[_]] = Context { type PrefixType = TraversableLike[T, CC[T]] }
  def f() = macro f_impl
  def f_impl(c: Alias[Int, List])() = ???
}

// This one doesn't
object Test2 {
  type Ctx = scala.reflect.macros.Context
  type Alias[T, CC[_]] = Ctx { type PrefixType = TraversableLike[T, CC[T]] }

  def f() = macro f_impl
  def f_impl(c: Alias[Int, List])() = ???
}

The error is:

./a.scala:15: error: macro implementation has wrong shape:
 required: (c: scala.reflect.macros.Context)(): c.Expr[Any]
 found   : (c: Test2.Alias[Int,List])(): Nothing
type mismatch for parameter c: scala.reflect.macros.Context does not conform to Test2.Ctx{type PrefixType = scala.collection.TraversableLike[Int,List[Int]]}
  def f() = macro f_impl
                  ^
one error found
@scabug
Copy link
Author

@scabug scabug commented Oct 11, 2012

@scabug
Copy link
Author

@scabug scabug commented Oct 11, 2012

@scabug
Copy link
Author

@scabug scabug commented Oct 11, 2012

@paulp said:
I think it will be enough to say "tpe =:= MacroContextClass.tpe" rather than == .

@scabug
Copy link
Author

@scabug scabug commented Nov 9, 2012

@xeno-by said:
This bug is being fixed

@scabug
Copy link
Author

@scabug scabug commented Jan 30, 2013

@scabug
Copy link
Author

@scabug scabug commented Jan 31, 2013

@paulp said:
ccd7abe897a

@scabug scabug closed this Jan 31, 2013
@scabug scabug added the macros label Apr 7, 2017
@scabug scabug added this to the 2.10.1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants