Skip to content

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

Merged
merged 3 commits into from
Jul 16, 2017

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@felixmulder
Copy link
Contributor

@nicolasstucki - needs rebase

val sym = tree.symbol
if (sym is Inline) {
tree match {
case _: TypeDef =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PlainPrinter.kindString

Copy link
Contributor

@odersky odersky left a 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.

@nicolasstucki nicolasstucki force-pushed the fix-#2421 branch 2 times, most recently from ba009b5 to 82ac78d Compare June 14, 2017 10:39
@nicolasstucki
Copy link
Contributor Author

Moved checks to checkFlags

@nicolasstucki
Copy link
Contributor Author

All requested changes were addressed.

Check modifiers `lazy` and `inline` for inapplicability
@nicolasstucki
Copy link
Contributor Author

@odersky odersky dismissed their stale review July 15, 2017 15:12

I changed the code myself

@odersky
Copy link
Contributor

odersky commented Jul 15, 2017

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))
Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@nicolasstucki
Copy link
Contributor Author

LGTM

@odersky odersky merged commit 76df105 into scala:master Jul 16, 2017
@allanrenucci allanrenucci deleted the fix-#2421 branch December 14, 2017 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants