Skip to content

Fix #6783: Check all owner to detect if inside an inline method #6788

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 1 commit into from
Jul 2, 2019

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

Add the 2nd as a test too?

@@ -2082,7 +2082,7 @@ class Typer extends Namer
}

private def checkSpliceOutsideQuote(tree: untpd.Tree)(implicit ctx: Context): Unit = {
if (level == 0 && !ctx.owner.isInlineMethod)
if (level == 0 && !ctx.owner.ownersIterator.exists(_.is(Inline)))
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the following code?

inline def foo() = {
  class A {
    def bar = $(...)
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will fall back to error message of the macro body checking .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those checks are performed by the Splicer

@nicolasstucki nicolasstucki merged commit 1cec6a9 into scala:master Jul 2, 2019
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