-
Notifications
You must be signed in to change notification settings - Fork 40
emit overridden methods for method SymbolInformation #172
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
Show all changes
5 commits
Select commit
Hold shift + click to select a range
61ed512
emit overridden methods for method SymbolInformation
Strum355 2609127
link overrides to overridden symbol's referenceResult
Strum355 f241007
add unit test for symbolinformation overrides
Strum355 a393f40
link referenceResult of overridden symbol to range of overriding symbol
Strum355 3873456
assertNoDiff for overridden symbols list
Strum355 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| package tests | ||
|
|
||
| import java.util.stream.Collectors | ||
|
|
||
| import scala.meta.Input | ||
|
|
||
| import com.sourcegraph.lsif_semanticdb.Symtab | ||
| import munit.FunSuite | ||
| import munit.TestOptions | ||
|
|
||
| class OverridesSuite extends FunSuite with TempDirectories { | ||
|
|
||
| val targetroot = new DirectoryFixture() | ||
|
|
||
| override def munitFixtures: Seq[Fixture[_]] = | ||
| super.munitFixtures ++ List(targetroot) | ||
|
|
||
| def checkOverrides( | ||
| options: TestOptions, | ||
| source: String, | ||
| extractSymbol: String, | ||
| expectedSymbols: String* | ||
| ): Unit = { | ||
| test(options) { | ||
| val compiler = new TestCompiler(targetroot()) | ||
| val relativePath = "example.Parent".replace('.', '/') + ".java" | ||
| val input = Input.VirtualFile(relativePath, source) | ||
| val result = compiler.compileSemanticdb(List(input)) | ||
| val symtab = new Symtab(result.textDocument) | ||
|
|
||
| val expectedSyms = expectedSymbols.mkString("\n") | ||
| val syms = symtab | ||
| .symbols | ||
| .get(extractSymbol) | ||
| .getOverriddenSymbolsList | ||
| .stream | ||
| .collect(Collectors.joining("\n")) | ||
| assertNoDiff(expectedSyms, syms) | ||
| } | ||
| } | ||
|
|
||
| checkOverrides( | ||
| "same file", | ||
| """package example; | ||
| | | ||
| |class Parent { | ||
| | public void stuff() {} | ||
| | | ||
| | class Child extends Parent { | ||
| | @Override | ||
| | public void stuff() {} | ||
| | } | ||
| |} | ||
| |""".stripMargin, | ||
| "example/Parent#Child#stuff().", | ||
| "example/Parent#stuff()." | ||
| ) | ||
|
|
||
| checkOverrides( | ||
| "external override", | ||
| """package example; | ||
| | | ||
| |class Parent { | ||
| | @Override | ||
| | public String toString() { return ""; } | ||
| |} | ||
| |""".stripMargin, | ||
| "example/Parent#toString().", | ||
| "java/lang/Object#toString()." | ||
| ) | ||
|
|
||
| checkOverrides( | ||
| "implement interface", | ||
| """package example; | ||
| | | ||
| |class Parent { | ||
| | interface Test { | ||
| | public void stuff(); | ||
| | } | ||
| | | ||
| | class Child implements Test { | ||
| | @Override | ||
| | public void stuff() {} | ||
| | } | ||
| |} | ||
| |""".stripMargin, | ||
| "example/Parent#Child#stuff().", | ||
| "example/Parent#Test#stuff()." | ||
| ) | ||
|
|
||
| checkOverrides( | ||
| "type params", | ||
| """package example; | ||
| | | ||
| |class Parent { | ||
| | interface Haha<T> { | ||
| | void add(T elem); | ||
| | } | ||
| | class IntHaha implements Haha<Integer> { | ||
| | void add(Integer elem) {} | ||
| | } | ||
| |} | ||
| |""".stripMargin, | ||
| "example/Parent#IntHaha#add().", | ||
| "example/Parent#Haha#add()." | ||
| ) | ||
|
|
||
| checkOverrides( | ||
| "multiple", | ||
| """package example; | ||
| | | ||
| |class Parent { | ||
| | @Override | ||
| | public String toString() { return ""; } | ||
| | | ||
| | class Child extends Parent { | ||
| | @Override | ||
| | public String toString() { return ""; } | ||
| | } | ||
| |} | ||
| |""".stripMargin, | ||
| "example/Parent#Child#toString().", | ||
| """example/Parent#toString(). | ||
| |java/lang/Object#toString(). | ||
| |""".stripMargin | ||
| ) | ||
|
|
||
| checkOverrides( | ||
| "abstract", | ||
| """package example; | ||
| | | ||
| |abstract class Parent { | ||
| | public abstract void stuff(); | ||
| | | ||
| | class Child extends Parent { | ||
| | @Override | ||
| | public void stuff() {} | ||
| | } | ||
| |} | ||
| |""".stripMargin, | ||
| "example/Parent#Child#stuff().", | ||
| "example/Parent#stuff()." | ||
| ) | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.