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

Do not lint multiarg for mixed op def #9026

Merged
merged 1 commit into from Jun 4, 2020

Conversation

som-snytt
Copy link
Contributor

Follow-up per review by @SethTisue

Remove lint of definition of lines_!, which is arguably innocent.

@scala-jenkins scala-jenkins added this to the 2.13.4 milestone Jun 2, 2020
@SethTisue SethTisue modified the milestones: 2.13.4, 2.13.3 Jun 2, 2020
@SethTisue
Copy link
Member

context is #8951 (comment)

@SethTisue
Copy link
Member

SethTisue commented Jun 2, 2020

couldn't isOperatorName just be defined as isOperatorChar(decoded.head)? (he asked innocently, bracing himself for a lesson on why we can't have nice things)

@som-snytt
Copy link
Contributor Author

Actually, Seth, after I boned up (so to speak) on NameTransformer, I was too tired to overthink it. The comment was that the IDE used it. A name can be arbitrarily junk. Like boldface.

scala> TermName("x")
val res0: u.TermName = x

scala> TermName("*x*")
val res1: u.TermName = *x*

@som-snytt
Copy link
Contributor Author

As usual, I wound up taking Seth's advice. isOperatorName is used in a couple of places (reflection uses it to decide whether to print backquoted idents). A test actually tests a*.

Since we only care about legal idents, the lint only checks for leading op char.

Oh wait, there's still the question of backticks. Oh wait, I'm too tired.

Copy link
Member

@SethTisue SethTisue left a comment

Choose a reason for hiding this comment

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

LGTM, and this still seems right to me even if backticks enter the picture. But perhaps one more reviewer would like to ponder all of this at least a little before we hit "merge".

@eed3si9n
Copy link
Member

@SethTisue

couldn't isOperatorName just be defined as isOperatorChar(decoded.head)? (he asked innocently, bracing himself for a lesson on why we can't have nice things)

Here's a counter example: def unary_! : Foo = this

There's a whitespace between ! and : required, and name.isOperatorName is used to check for that kind of stuff in Printers

protected def blankForOperatorName(name: Name) = checkForBlank(name.isOperatorName)
protected def blankForName(name: Name) = checkForBlank(name.isOperatorName || name.endsWith("_"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants