Skip to content

Commit

Permalink
First try at extracting class infos
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Abate authored and BryanAbate committed Jun 15, 2019
1 parent 92e1a17 commit 970e288
Show file tree
Hide file tree
Showing 38 changed files with 850 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,15 @@ community-build/sbt-dotty-sbt

# Vulpix output files
*.check.out

tastydoc/report/report\.aux

tastydoc/report/report\.fdb_latexmk

tastydoc/report/report\.fls

tastydoc/report/report\.out

tastydoc/report/report\.synctex\.gz

tastydoc/report/report\.toc
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ val `dotty-bench` = Build.`dotty-bench`
val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`
val `dotty-semanticdb` = Build.`dotty-semanticdb`
val `dotty-semanticdb-input` = Build.`dotty-semanticdb-input`
val `dotty-tastydoc` = Build.`dotty-tastydoc`
val `dotty-tastydoc-input` = Build.`dotty-tastydoc-input`
val `scala-library` = Build.`scala-library`
val `scala-compiler` = Build.`scala-compiler`
val `scala-reflect` = Build.`scala-reflect`
Expand Down
23 changes: 21 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,15 @@ object Build {
)
)

def dottyDocSettings(implicit mode: Mode) = Seq(
lazy val tastydocSettings = Seq(
baseDirectory in (Compile, run) := baseDirectory.value / "..",
baseDirectory in Test := baseDirectory.value / "..",
libraryDependencies +=
"com.novocode" % "junit-interface" % "0.11"
)

// Settings shared between dotty-doc and dotty-doc-bootstrapped
lazy val dottyDocSettings = Seq(
baseDirectory in (Compile, run) := baseDirectory.value / "..",
baseDirectory in Test := baseDirectory.value / "..",

Expand Down Expand Up @@ -976,6 +984,9 @@ object Build {
addCompilerPlugin("org.scalameta" % "semanticdb-scalac" % "4.0.0" cross CrossVersion.full)
)

lazy val `dotty-tastydoc` = project.in(file("tastydoc")).asDottyTastydoc(Bootstrapped)
lazy val `dotty-tastydoc-input` = project.in(file("tastydoc/input")).asDottyTastydocInput(Bootstrapped)

// Depend on dotty-library so that sbt projects using dotty automatically
// depend on the dotty-library
lazy val `scala-library` = project.
Expand Down Expand Up @@ -1263,6 +1274,14 @@ object Build {
dependsOn(dottyCompiler).
settings(semanticdbSettings)

def asDottyTastydoc(implicit mode: Mode): Project = project.withCommonSettings.
aggregate(`dotty-tastydoc-input`).
dependsOn(dottyCompiler).
settings(tastydocSettings)

def asDottyTastydocInput(implicit mode: Mode): Project = project.withCommonSettings.
dependsOn(dottyCompiler)

def asDist(implicit mode: Mode): Project = project.
enablePlugins(PackPlugin).
withCommonSettings.
Expand All @@ -1277,4 +1296,4 @@ object Build {
case Bootstrapped => commonBootstrappedSettings
})
}
}
}
1 change: 1 addition & 0 deletions semanticdb/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.2.6
1 change: 1 addition & 0 deletions tastydoc/input/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.2.3
11 changes: 11 additions & 0 deletions tastydoc/input/src/main/scala/example/Access.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package example

class Access {
private def m1 = ???
private[this] def m2 = ???
private[Access] def m3 = ???
protected def m4 = ???
protected[this] def m5 = ???
protected[example] def m6 = ???
def m7 = ???
}
39 changes: 39 additions & 0 deletions tastydoc/input/src/main/scala/example/Advanced.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package example

import scala.language.existentials
import scala.language.higherKinds
import scala.language.reflectiveCalls

class AdvC[T] {
def t: T = ???
}

class Structural {
def s1: { val x: Int } = ???
def s2 = new { val x: Int = ??? }
def s3 = new { def m(x: Int): Int = ??? }
}

class Existential {
def e1: List[_] = ???
}

class AdvD[CC[B]] extends AdvC[CC[B]]

object AdvTest {
val s = new Structural
val s1 = s.s1
val s2 = s.s2
val s3 = s.s3

val e = new Existential
val e1 = e.e1
val e1x = e.e1.head
locally {
(??? : Any) match {
case e3: List[_] =>
val e3x = e3.head
()
}
}
}
18 changes: 18 additions & 0 deletions tastydoc/input/src/main/scala/example/Anonymous.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package example
import scala.language.higherKinds

class Anonymous {
this: Anonymous =>

def m1[T[_], B] = ???
def m2: Map[_, List[_]] = ???
locally {
??? match { case _: List[_] => }
}
locally {
val x: Int => Int = _ => ???
}

trait Foo
var x = new Foo {}
}
33 changes: 33 additions & 0 deletions tastydoc/input/src/main/scala/example/Classes.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package example

class C1(val x1: Int) extends AnyVal

class C2(val x2: Int) extends AnyVal
object C2

case class C3(x: Int)

case class C4(x: Int)
object C4

object M {
implicit class C5(x: Int)
}

case class C6(private val x: Int)

class C7(x: Int)

class C8(private[this] val x: Int)

class C9(private[this] var x: Int)

object N {
val anonClass = new C7(42) {
val local = ???
}
val anonFun = List(1).map { i =>
val local = 2
local + 2
}
}
9 changes: 9 additions & 0 deletions tastydoc/input/src/main/scala/example/Empty.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package example

class AdvA {
def b: AdvB = ???
}

class AdvB {
def a: AdvA = ???
}
3 changes: 3 additions & 0 deletions tastydoc/input/src/main/scala/example/EmptyObject.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package example

object EmptyObject {}
21 changes: 21 additions & 0 deletions tastydoc/input/src/main/scala/example/Example.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package example

class Example {
val a: String = "1"
def a(
x: Int
): String =
x.toString
def a(
x: Int,
y: Int
): String =
a(
x +
y
)
}

class ExampleInit() {

}
10 changes: 10 additions & 0 deletions tastydoc/input/src/main/scala/example/Example2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package example

import scala.concurrent.Future

object OExample { self =>
def main(args: Array[String]): Unit = {
println(1)
}
val x = scala.reflect.classTag[Int]
}
4 changes: 4 additions & 0 deletions tastydoc/input/src/main/scala/example/Exclude.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package example

// This class should be excluded by semanticdb.
class Exclude
24 changes: 24 additions & 0 deletions tastydoc/input/src/main/scala/example/Flags.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package example

/*package*/ object p {
private lazy val x = 1
protected implicit var y: Int = 2
def z(pp: Int) = 3
def m[TT] = ???
abstract class C[+T, -U, V](x: T, y: U, z: V) {
def this() = this(???, ???, ???)
def w: Int
}
type T1 = Int
type T2[T] = S[T]
type U <: Int
type V >: Int
case object X
final class Y
sealed trait Z
class AA(x: Int, val y: Int, var z: Int)
class S[@specialized T]
val List(xs1) = ???
??? match { case List(xs2) => ??? }
??? match { case _: List[t] => ??? }
}
1 change: 1 addition & 0 deletions tastydoc/input/src/main/scala/example/Imports.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//import scala.util.control.NonFatal
11 changes: 11 additions & 0 deletions tastydoc/input/src/main/scala/example/Issue1749.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// See https://github.com/scalameta/scalameta/issues/1749
package example

import scala.math.Ordered.orderingToOrdered

class Issue1749 {
val x1 = 42
val x2 = 42
(x1, x1)
.compare((x2, x2))
}
8 changes: 8 additions & 0 deletions tastydoc/input/src/main/scala/example/Locals.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package example

object Test {
val xs = {
val x = 42
List(x)
}
}
5 changes: 5 additions & 0 deletions tastydoc/input/src/main/scala/example/MacroAnnotations.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package example

//@MacroAnnotation
class MacroAnnotations
object MacroAnnotations
33 changes: 33 additions & 0 deletions tastydoc/input/src/main/scala/example/MethodUsages.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package example

class MethodUsages {
val m = new Methods[Int]
m.m1
m.m2()
m.m3(0)
m.m4(0)(0)
m.m5("")
m.m5(0)
m.m6(0)
m.m6(new m.List[Int])
m.m6(Nil)
m.m7a(m, new m.List[Int])
m.m7b(new m.List[Int])
m.`m8().`()
m.m9(null)
m.m10(null)
m.m11(Predef)
m.m11(OExample)
m.m12a(null)
m.m12b(null)
m.m13(0)
m.m15(0)
m.m16(0)
m.m16(0)
m.m17.m()
m.m17(1)
m.m17("")
m.m18.m()
m.m18(1)
m.m18("")
}
38 changes: 38 additions & 0 deletions tastydoc/input/src/main/scala/example/Methods.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package example

import scala.math.Ordering
import scala.language.existentials

class Methods[T] {
class List[T]
type AList[T] = List[T]
def m1 = ???
def m2() = ???
def m3(x: Int) = ???
def m4(x: Int)(y: Int) = ???
def m5(x: String) = ???
def m5(x: Int) = ???
def m6(x: Int) = ???
def m6(x: List[T]) = ???
def m6(x: scala.List[T]) = ???
def m7a[U: Ordering](c: Methods[T], l: List[U]) = ???
def m7b[U <: T](l: List[U]) = ???
def `m8().`() = ???
class `m9().`
def m9(x: `m9().`) = ???
def m10(x: AList[T]) = ???
def m11(x: Predef.type) = ???
def m11(x: OExample.type) = ???
def m12a(x: {}) = ???
def m12b(x: { val x: Int }) = ???
def m13(x: Int @unchecked) = ???
def m15(x: => Int) = ???
def m16(x: Int*) = ???
object m17 { def m() = ??? }
def m17(a: Int) = ???
def m17(b: String) = ???
val m18 = m17
def m18(a: Int) = ???
def m18(b: String) = ???
def m19(x: Int, y: Int = 2)(z: Int = 3) = ???
}
5 changes: 5 additions & 0 deletions tastydoc/input/src/main/scala/example/Objects.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package example

object X {
object Y
}
4 changes: 4 additions & 0 deletions tastydoc/input/src/main/scala/example/Overrides.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package example

trait OveA { def foo: Int }
class OveB() extends OveA { def foo: Int = 2 }
Loading

0 comments on commit 970e288

Please sign in to comment.