-
Notifications
You must be signed in to change notification settings - Fork 21
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
sanity checks for macro expansions #8066
Comments
@xeno-by said:
So #1 is definitely a compilation error. #2 looks like a compilation error as well, but we should actually consider detecting attributed trees spliced under symbol-introducing trees in the expansion and report that as as an error, because someone might end up splicing symbol-introducing trees there, even if in the current expansion it's just something simple. In 2.10.5 that should probably be an on-by-default warning that can be turned off by a -Y flag. I think we should turn #3 into a compilation error as well. Even though it's going to work just fine, it's a symptom of something going wrong. Finally, for better error reporting I think we could have quasiquotes remember their origins (maybe in attachments), so that we could say something like: "attempt to insert an untyped tree foo (defined in Foo.scala:42) under a type tree bar (coming from an argument of the macro expansion)". |
@xeno-by said: Test.scala:8: error: type mismatch;
found : <notype>
required: Any
Note that <none> extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
Macros.foo
^
one error found This should be caught by the validator. Also, it would be useful if the validator could tell people that such code doesn't make sense anyway, because the expanded definition is going to be local. |
@xeno-by said: |
@xeno-by said: |
@xeno-by said: |
@xeno-by said: |
closing since this never happened and it's far from clear that a change like this is likely ever to happen in the current macro system |
There are some macro-induced compiler crashes in SuperAccessors, LambdaLift and GenICode (some of those documented at sbt/sbt@3b213e5) that we can easily avoid by providing a sanity-checking traverser for macro expansions. I will get to that this week.
The text was updated successfully, but these errors were encountered: