-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2421: Add errors for inline on non supported trees #2476
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
Conversation
@nicolasstucki - needs rebase |
val sym = tree.symbol | ||
if (sym is Inline) { | ||
tree match { | ||
case _: TypeDef => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlainPrinter.kindString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a method checkFlags in Namer. I think it's cleaner to integrate with that method. Can you try to use the logic of that method to formulate your tests?
The checkFlags method also has the advantage that it will not let illegal flags be added to symbols. We should keep that property.
ba009b5
to
82ac78d
Compare
Moved checks to checkFlags |
All requested changes were addressed. |
Check modifiers `lazy` and `inline` for inapplicability
@odersky it looks like your commits lost the test file https://github.com/dotty-staging/dotty/blob/ee331a6fa255638c8db59dae269198d3a8c3dba9/tests/neg/i2421.scala |
I found a solution that requires less code and fits better. @nicolasstucki do you want to review? |
fail(i"illegal combination of modifiers: $flag1 and $flag2 for: $sym") | ||
fail(i"illegal combination of modifiers: `$flag1` and `$flag2` for: $sym") | ||
def checkApplicable(flag: FlagSet, ok: Boolean) = | ||
if (!ok && !sym.is(Synthetic)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the !sym.is(Synthetic)
needed here? Is it only for the lazy val
of the modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now yes, but there might be other synthetic symbols with conflicts. In any case, if it is synthetic we should not issue an error message to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
LGTM |
No description provided.