Skip to content

Use inline flag instead of @inline annotation #1677

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
Nov 10, 2016

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Nov 7, 2016

Convert @inline annotations to inline flags, not the
other way round as was done before.

This is the first step to fixing #1647, which requires a reorganization how
annotations are handled.

I wanted to get the irregular treatement of inline annotations out of the way before trying this.

Review by @smarter. Feel free to cherry-pick for getting the new repo structure to work.

Convert `@inline` annotations to `inline` flags, not the
other way round as was done before.
is(Method, butNot = Accessor) &&
!isCompleting && // don't force method type; recursive inlines are ignored anyway.
hasAnnotation(defn.InlineAnnot)
def isInlineMethod(implicit ctx: Context): Boolean = is(InlineMethod, butNot = Accessor)
Copy link
Member

Choose a reason for hiding this comment

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

Is the butNot still necessary? Do accessors get the inline flag too somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They might if we have an accessor of an inline val. Better play it safe.

@@ -521,6 +521,7 @@ class Namer { typer: Typer =>
mergeCompanionDefs()
val ctxWithStats = (ctx /: stats) ((ctx, stat) => indexExpanded(stat)(ctx))
createCompanionLinks(ctxWithStats)
//stats foreach enterAnnotations
Copy link
Member

Choose a reason for hiding this comment

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

Stray comment?

addInlineInfo(denot, original)
if (cls == defn.InlineAnnot && denot.is(Method, butNot = Accessor))
denot.setFlag(Inline)
if (denot.isInlineMethod) addInlineInfo(denot, original)
Copy link
Member

Choose a reason for hiding this comment

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

This means that addInlineInfo will be called for every annotation if the method is marked inline, previously hasInlineAnnot prevented that.

@odersky
Copy link
Contributor Author

odersky commented Nov 10, 2016

Merging now, because there's more to come...

@odersky odersky merged commit 28c2e04 into scala:master Nov 10, 2016
@allanrenucci allanrenucci deleted the fix-#1647 branch December 14, 2017 16:59
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.

2 participants