bug icon indicating copy to clipboard operation
bug copied to clipboard

Macros should support untyped parameters

Open scabug opened this issue 13 years ago • 3 comments

Sometimes it's necessary to pass parameters to macros untyped (e.g. if a parameter is a closure that refers to variables that are introduced by a macro). However, current implementation doesn't support this notion - all params are typechecked before the macro is expanded.

scabug avatar Jan 24 '12 16:01 scabug

Imported From: https://issues.scala-lang.org/browse/SI-5404?orig=1 Reporter: @xeno-by Affected Versions: 2.10.0

scabug avatar Jan 24 '12 16:01 scabug

@xeno-by said: Won't be implemented in the near future (i.e. 99% that it won't make it in the first public release of macros).

scabug avatar Feb 17 '12 13:02 scabug

@milessabin said (edited on Apr 20, 2012 7:49:39 PM UTC): Another use-case for this is a compile-time test that a given expression should not compile. Eg. suppose we have a type class Foo[T] which should not have instances for String, then it would be highly desirable to be able to write a test of the form,

shouldNotCompile(implicitly[Foo[String]])

which typechecks iff implicitly[Foo[String]] does not typecheck.

scabug avatar Apr 20 '12 19:04 scabug