Skip to content

Commit

Permalink
traverse parents if span exists
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Dec 13, 2019
1 parent 69f3d60 commit dc1e127
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,8 @@ class ExtractSemanticDB extends Phase with
if !excludeDef(ctorSym)
registerDefinition(ctorSym, tree.constr.span, Set.empty)
ctorParams(tree.constr.vparamss, tree.body)(traverseCtorParamTpt(ctorSym, _))
for parent <- tree.parentsOrDerived do
if
parent.symbol != defn.ObjectClass.primaryConstructor
&& parent.tpe.dealias != defn.SerializableType
&& parent.symbol != defn.ProductClass
then
traverse(parent)
for parent <- tree.parentsOrDerived if parent.span.hasLength do
traverse(parent)
val selfSpan = tree.self.span
if selfSpan.exists && selfSpan.hasLength then
traverse(tree.self)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/semanticdb/Tools.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object Tools with
val realURI = realPath.toString
given SourceFile = SourceFile.virtual(doc.uri, doc.text)
sb.append(realURI).nl
sb.append("_" * realURI.length).nl
sb.append("-" * realURI.length).nl
sb.nl
sb.append("Summary:").nl
sb.append("Schema => ").append(schemaString(doc.schema)).nl
Expand Down
2 changes: 1 addition & 1 deletion tests/semanticdb/expect/filename with spaces.expect.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package example

class FilenameWithSpaces/*<-example::FilenameWithSpaces#*//*<=example.FilenameWithSpaces#*/
class FilenameWithSpaces/*<-example::FilenameWithSpaces#*/
2 changes: 1 addition & 1 deletion tests/semanticdb/expect/filename with spaces.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package example

class FilenameWithSpaces/*<=example.FilenameWithSpaces#*/
class FilenameWithSpaces
Loading

0 comments on commit dc1e127

Please sign in to comment.