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

Backport "Added jpath check to ClassLikeSupport getParentsAsTreeSymbolTuples" #16928

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scaladoc-testcases/src/tests/nonScala3Parent.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package tests
package nonScala3Parent

import javax.swing.JPanel
import javax.swing.JFrame

// https://github.com/lampepfl/dotty/issues/15927

trait Foo1 extends Numeric[Any]
trait Foo2 extends JPanel
trait Foo3 extends JFrame
trait Foo4 extends Ordering[Any]
trait Foo5 extends Enumeration
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ trait ClassLikeSupport:
def getParentsAsTreeSymbolTuples: List[(Tree, Symbol)] =
if noPosClassDefs.contains(c.symbol) then Nil
else for
parentTree <- c.parents if parentTree.pos.start != parentTree.pos.end // We assume here that order is correct
// TODO: add exists function to position methods in Quotes and replace the condition here for checking the JPath
parentTree <- c.parents if parentTree.pos.sourceFile.getJPath.isDefined && parentTree.pos.start != parentTree.pos.end // We assume here that order is correct
parentSymbol = parentTree match
case t: TypeTree => t.tpe.typeSymbol
case tree if tree.symbol.isClassConstructor => tree.symbol.owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ class ImplicitMembers extends SignatureTest(
Seq("def"),
filterFunc = _.toString.endsWith("OuterClass$ImplicitMemberTarget.html")
)

class NonScala3Parent extends SignatureTest("nonScala3Parent", SignatureTest.all)