| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clarifies the language and rules for eta-expansion.
A missing argument in a list, as opposed to a missing
argument list, results in a different message.
The comical expansion in parens does not attempt to show
what was already applied, but succeeds in showing at a
glance the shape of the method in question.
```
scala> def m(i: Int, j: Int)(x: Int) = ???
m: (i: Int, j: Int)(x: Int)Nothing
scala> m
<console>:12: error: missing argument list for method m
Unapplied methods are only converted to functions when a function type is expected.
You can make this conversion explicit by writing `m _` or `m(_,_)(_)` instead of `m`.
m
^
```
The original submission was due to sschaef and the wording due
to adriaanm, with a minor tweak.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previous version of the MacroImplReference extractor didn't take into
the account the fact that RefTree.qualifier.symbol can be null (and it can
be null if RefTree is an Ident, because then qualifier is an EmptyTree).
This led to NPEs for really weird macro defs that refer to local methods
as their corresponding macro impls. Now I check for this corner case,
and the stuff now longer crashes.
This was wrong; this is how I fixed it; the world is now a better place.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Upgrades the way that macro defs are compiled by factoring out most of
the logic in typedMacroBody and related errors in ContextErrors into an
standalone cake. This leads to tighter cohesion and better code reuse
as the cake is isolated from the rest of the compiler and is much easier
to evolve than just a method body.
Increased convenience of coding macro compilation allowed me to further
clarify the implementation of the macro engine (e.g. take a look at
Validators.scala) and to easily implement additional features, namely:
1) Parameters and return type of macro implementations can now be plain
c.Tree's instead of previously mandatory c.Expr's. This makes macros more
lightweight as there are a lot of situations when one doesn't need to
splice macro params (the only motivation to use exprs over trees). Also
as we're on the verge of having quasiquotes in trunk, there soon will be
no reason to use exprs at all, since quasiquotes can splice everything.
2) Macro implementations can now be defined in bundles, standalone cakes
built around a macro context: http://docs.scala-lang.org/overviews/macros/bundles.html.
This further reduces boilerplate by simplifying implementations complex
macros due to the fact that macro programmers no longer need to play
path-dependent games to use helpers.
|
|
putting in a nutshell, this patch:
* condenses some macro-XXX-a/b/c/... bundles
* renames some tests to prepare for other macro flavors
* introduces some additional tests
|