-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix: complete backticked idents containing $
#11024
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: complete backticked idents containing
$
Replace the ad-hoc check for hiding from completions identifiers containing a `$` with a check against specific flavours of compiler-generated $-contai 10000 ning names.
- Loading branch information
commit 1b0c18f69e6afd0ed6b1ad545d1767073c477ea2
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
reload: Completions.scala | ||
|
||
askScopeCompletion at Completions.scala(5,2) | ||
================================================================================ | ||
[response] askScopeCompletion at (5,2) | ||
retrieved 16 members | ||
abstract trait T extends AnyRef | ||
case class C1 extends Product with Serializable | ||
class C2 extends AnyRef | ||
def <init>(x: Int): test.C1 | ||
def canEqual(x$1: Any): Boolean | ||
def copy(x: Int): test.C1 | ||
def productArity: Int | ||
def productElement(x$1: Int): Any | ||
object C1 | ||
override def equals(x$1: Any): Boolean | ||
override def hashCode(): Int | ||
override def productElementName(x$1: Int): String | ||
override def productIterator: Iterator[Any] | ||
override def productPrefix: String | ||
override def toString(): String | ||
private[this] val x: Int | ||
================================================================================ | ||
|
||
askScopeCompletion at Completions.scala(12,2) | ||
================================================================================ | ||
[response] askScopeCompletion at (12,2) | ||
retrieved 4 members | ||
abstract trait T extends AnyRef | ||
case class C1 extends Product with Serializable | ||
class C2 extends AnyRef | ||
object C1 | ||
================================================================================ | ||
|
||
askScopeCompletion at Completions.scala(21,2) | ||
================================================================================ | ||
[response] askScopeCompletion at (21,2) | ||
retrieved 8 members | ||
abstract trait T extends AnyRef | ||
case class C1 extends Product with Serializable | ||
class C2 extends AnyRef | ||
def $: Int | ||
def $var: Int | ||
def <init>(): test.C2 | ||
def dollar$: Int | ||
object C1 | ||
================================================================================ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import scala.tools.nsc.interactive.tests.InteractiveTest | ||
|
||
object Test extends InteractiveTest |
22 changes: 22 additions & 0 deletions
22
test/files/presentation/dollar-completion/src/Completions.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package test | ||
|
||
case class C1(x: Int) { | ||
// Filter out `def copy$default$1: Int` | ||
/*_*/ | ||
} | ||
|
||
trait T { | ||
println("hello") | ||
|
||
// Filter out `$init$` | ||
/*_*/ | ||
} | ||
|
||
class C2 { | ||
def `$` = 1 | ||
def `dollar$` = 2 | ||
def `$var` = 3 | ||
|
||
// Include explicit dollar methods | ||
/*_*/ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why these 4x
self
show up now?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, these are the fields you get from implicit classes:
scala.Predef.any2stringadd
scala.Predef.StringFormat
scala.Predef.Ensuring
scala.Predef.ArrowAssoc
In all 4 cases, the implicit class field is called
self
.They did not used to show up because the decoded names have dollar signs (I'm guessing this is connected to the fact they're declare in the
object Predef
, though I didn't look further)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks. I don't have the background why
[inaccessible]
symbols are included in completions. I wonder if inaccessible symbols of implicit conversion targets should really be there as well, or if that is by mistake.The
scala$Predef$any2stringadd$$self
name is an "expanded" name set bysym.makeNotPrivate
,sym.hasFlag(EXPANDEDNAME)
should be true here.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
[inaccessible]
means that it doesn't actually show up in the completions. These tests have completions that generally do include results that need an implicit conversion, so I think this is the right behavior.