Skip to content
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

Only check newVal/newMethod privateWithin on -Xcheck-macros #17437

Merged
merged 1 commit into from
May 9, 2023

Conversation

nicolasstucki
Copy link
Contributor

Closes #17432

@sjrd
Copy link
Member

sjrd commented May 9, 2023

If it's a term, we should still drop it in favor of NoSymbol. Otherwise it breaks TASTy.

@@ -2540,13 +2540,15 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
def newMethod(owner: Symbol, name: String, tpe: TypeRepr): Symbol =
newMethod(owner, name, tpe, Flags.EmptyFlags, noSymbol)
def newMethod(owner: Symbol, name: String, tpe: TypeRepr, flags: Flags, privateWithin: Symbol): Symbol =
assert(!privateWithin.exists || privateWithin.isType, "privateWithin must be a type symbol or `Symbol.noSymbol`")
xCheckMacroAssert(!privateWithin.exists || privateWithin.isType, "privateWithin must be a type symbol or `Symbol.noSymbol`")
val privateWithin1 = if privateWithin.isTerm then Symbol.noSymbol else privateWithin
checkValidFlags(flags.toTermFlags, Flags.validMethodFlags)
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags | dotc.core.Flags.Method, tpe, privateWithin)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags | dotc.core.Flags.Method, tpe, privateWithin)
dotc.core.Symbols.newSymbol(owner, name.toTermName, flags | dotc.core.Flags.Method, tpe, privateWithin1)

;)

@nicolasstucki nicolasstucki marked this pull request as ready for review May 9, 2023 18:54
@nicolasstucki nicolasstucki assigned sjrd and unassigned nicolasstucki May 9, 2023
@nicolasstucki nicolasstucki requested a review from sjrd May 9, 2023 18:55
@nicolasstucki nicolasstucki merged commit 8360a31 into scala:main May 9, 2023
@nicolasstucki nicolasstucki deleted the close-17432 branch May 9, 2023 18:56
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.

Compilation fails due to assertion in scala.quoted.runtime.impl.QuotesImpl$reflect$Symbol$.newVal
2 participants