diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-12-31 15:46:47 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-01-09 08:10:48 +0100 |
commit | fe6028476931b031e712c37d3e570125b1d034ae (patch) | |
tree | 54a47af764aa7ead11041a5488485c24818cf607 /test/files/pos/t5692b.check | |
parent | 30e2e3a78f9061ea93352427cb0ca205203041f0 (diff) | |
download | scala-fe6028476931b031e712c37d3e570125b1d034ae.tar.gz scala-fe6028476931b031e712c37d3e570125b1d034ae.tar.bz2 scala-fe6028476931b031e712c37d3e570125b1d034ae.zip |
SI-5923 adapt macros when they are deferred
Amazingly enough, the fix for the "macro not expanded" problem was super
easy. (And I remember spending a day or two trying to find a quick fix
somewhen around Scala Days 2012!)
The problem was in the implementation of the macro expansion trigger,
which was buried in a chain of if-elif-elif. This meant that macro
expansion was mutually exclusive with a lot of important adaptations, e.g.
with `instantiate`.
More precisely, if an expandee contains an undetparam, its expansion
should be delayed until all its undetparams are inferred and then retried
later. Sometimes such inference can only happen upon a call to instantiate
in one of the elif's coming after the macro expansion elif. However this
elif would never be called for expandees, because control flow would always
enter the macro expansion branch preceding the inference branch.
Consequences of this fix are vast. First of all, we can get rid of the
"type parameter must be specified" hack. Secondly and most importantly,
we can now remove the `materializeImplicit` method from Implicits and
rely on implicit macros to materialize tags for us. (This is a tricky
change, and I'll do it later after we merge as much of my pending work
as possible). Finally, we learn that the current scheme of interaction
between macros, type inference and implicits is, in principle, sound!
Diffstat (limited to 'test/files/pos/t5692b.check')
-rw-r--r-- | test/files/pos/t5692b.check | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/files/pos/t5692b.check b/test/files/pos/t5692b.check new file mode 100644 index 0000000000..16796826b4 --- /dev/null +++ b/test/files/pos/t5692b.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: these type parameters must be specified + def x = Macros.foo + ^ +one error found |