Skip to content

Commit dd285bb

Browse files
committed
Rename Type to TypeRepr in scal3doc
1 parent 89df9bd commit dd285bb

File tree

6 files changed

+31
-28
lines changed

6 files changed

+31
-28
lines changed

.github/workflows/scala3doc.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI for dotty-dokka
1+
name: CI for scala3doc
22

33
on:
44
push:
@@ -10,8 +10,6 @@ jobs:
1010
runs-on: ubuntu-latest
1111
timeout-minutes: 20
1212
steps:
13-
- name: set right cwd
14-
run: cd scala3doc
1513

1614
- uses: actions/checkout@v2
1715
- run: git fetch --prune --unshallow --tags
@@ -33,7 +31,7 @@ jobs:
3331
java-version: 11
3432

3533
- name: Compile and test
36-
run: ./project/scripts/sbt scala3doc/test
34+
run: ./project/scripts/sbt scala3doc-test/test
3735

3836
- name: Locally publish self
3937
run: ./project/scripts/sbt scala3doc/publishLocal
@@ -42,13 +40,16 @@ jobs:
4240
run: ./project/scripts/sbt scala3doc/generateSelfDocumentation
4341

4442
- name: Generate Scala 3 documentation
43+
run: ./project/scripts/sbt scala3doc/generateScala3Documentation
44+
45+
- name: Generate documentation for example project using dotty-sbt
4546
run: |
46-
./project/scripts/sbt sbt-dotty/publishLocal scala3-bootstrapped/publishLocal
47+
./project/scripts/sbt ";sbt-dotty/publishLocal;scala3/publishLocal;publishLocal"
4748
VERSION=$(./project/scripts/sbt "show sbt-dotty/version" | tail -1 | sed 's/\[info\] //')
4849
echo Using sbt-dotty version: $VERSION
4950
echo 'addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "'$VERSION'")' > scala3doc/example-project/project/dotty.sbt
5051
51-
SCALA_VERSION=$(./project/scripts/sbt "show scala3-bootstrapped/version" | tail -1 | sed 's/\[info\] //')
52+
SCALA_VERSION=$(./project/scripts/sbt "show scala3-compiler-bootstrapped/version" | tail -1 | sed 's/\[info\] //')
5253
echo Using scala version: $SCALA_VERSION
5354
echo 'scalaVersion := "'$SCALA_VERSION'"' > scala3doc/example-project/dotty.sbt
5455

scala3doc/src/dotty/dokka/tasty/BasicSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SymOps[R <: Reflection](val r: R):
7474
def getVisibility(): Visibility =
7575
import VisibilityScope._
7676

77-
def explicitScope(ownerType: Type): VisibilityScope =
77+
def explicitScope(ownerType: TypeRepr): VisibilityScope =
7878
val moduleSym = ownerType.typeSymbol.companionModule
7979
if moduleSym.isNoSymbol
8080
then ExplicitTypeScope(ownerType.typeSymbol.name)

scala3doc/src/dotty/dokka/tasty/ClassLikeSupport.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ trait ClassLikeSupport:
7979

8080
private val conversionSymbol = Symbol.requiredClass("scala.Conversion")
8181

82-
def extractImplicitConversion(tpe: Type): Option[ImplicitConversion] =
82+
def extractImplicitConversion(tpe: TypeRepr): Option[ImplicitConversion] =
8383
if tpe.derivesFrom(conversionSymbol) then None
8484
else tpe.baseType(conversionSymbol) match
85-
case AppliedType(tpe, List(from: Type, to: Type)) =>
85+
case AppliedType(tpe, List(from: TypeRepr, to: TypeRepr)) =>
8686
Some(ImplicitConversion(from.typeSymbol.dri, to.typeSymbol.dri))
8787
case _ =>
8888
None

scala3doc/src/dotty/dokka/tasty/SyntheticSupport.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ trait SyntheticsSupport:
77

88
import reflect._
99

10-
extension (t: Type):
10+
extension (t: TypeRepr):
1111
def isTupleType: Boolean = hackIsTupleType(self.reflect)(t)
1212

1313
def isCompiletimeAppliedType: Boolean = hackIsCompiletimeAppliedType(self.reflect)(t)
1414

15-
def hackIsTupleType(r: Reflection)(rtpe: r.Type): Boolean =
15+
def hackIsTupleType(r: Reflection)(rtpe: r.TypeRepr): Boolean =
1616
import dotty.tools.dotc
1717
given ctx as dotc.core.Contexts.Context = r.rootContext.asInstanceOf
1818
val tpe = rtpe.asInstanceOf[dotc.core.Types.Type]
1919
ctx.definitions.isTupleType(tpe)
2020

21-
def hackIsCompiletimeAppliedType(r: Reflection)(rtpe: r.Type): Boolean =
21+
def hackIsCompiletimeAppliedType(r: Reflection)(rtpe: r.TypeRepr): Boolean =
2222
import dotty.tools.dotc
2323
given ctx as dotc.core.Contexts.Context = r.rootContext.asInstanceOf
2424
val tpe = rtpe.asInstanceOf[dotc.core.Types.Type]
@@ -89,19 +89,19 @@ trait SyntheticsSupport:
8989
val ref = classdef.symbol.info.asInstanceOf[dotc.core.Types.ClassInfo].appliedRef
9090
val baseTypes: List[(dotc.core.Symbols.Symbol, dotc.core.Types.Type)] =
9191
ref.baseClasses.map(b => b -> ref.baseType(b))
92-
baseTypes.asInstanceOf[List[(r.Symbol, r.Type)]]
92+
baseTypes.asInstanceOf[List[(r.Symbol, r.TypeRepr)]]
9393
}
9494

9595
def getSupertypes(c: ClassDef) = hackGetSupertypes(self.reflect)(c).tail
9696

97-
def typeForClass(c: ClassDef): r.Type =
97+
def typeForClass(c: ClassDef): r.TypeRepr =
9898
import dotty.tools.dotc
9999
given dotc.core.Contexts.Context = r.rootContext.asInstanceOf
100100
val cSym = c.symbol.asInstanceOf[dotc.core.Symbols.Symbol]
101-
cSym.typeRef.appliedTo(cSym.typeParams.map(_.typeRef)).asInstanceOf[r.Type]
101+
cSym.typeRef.appliedTo(cSym.typeParams.map(_.typeRef)).asInstanceOf[r.TypeRepr]
102102

103103
object MatchTypeCase:
104-
def unapply(tpe: Type): Option[(Type, Type)] =
104+
def unapply(tpe: TypeRepr): Option[(TypeRepr, TypeRepr)] =
105105
tpe match
106106
case AppliedType(t, Seq(from, to)) /*if t == MatchCaseType*/ =>
107107
Some((from, to))

scala3doc/src/dotty/dokka/tasty/TypesSupport.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ trait TypesSupport:
1414
inner(tpeTree.tpe)
1515
case other => None
1616

17-
def inner(tpe: Type): Option[Symbol] = tpe match
17+
def inner(tpe: TypeRepr): Option[Symbol] = tpe match
1818
case ThisType(tpe) => inner(tpe)
1919
case AnnotatedType(tpe, _) => inner(tpe)
2020
case AppliedType(tpe, _) => inner(tpe)
2121
case tp @ TermRef(qual, typeName) =>
2222
qual match
23-
case _: Type | _: NoPrefix => Some(tp.termSymbol)
23+
case _: TypeRepr | _: NoPrefix => Some(tp.termSymbol)
2424
case other => None
2525
case tp @ TypeRef(qual, typeName) =>
2626
qual match
27-
case _: Type | _: NoPrefix => Some(tp.typeSymbol)
27+
case _: TypeRepr | _: NoPrefix => Some(tp.typeSymbol)
2828
case other => None
2929

3030
val typeSymbol = extractTypeSymbol(method.returnTpt)
@@ -46,7 +46,7 @@ trait TypesSupport:
4646
new GenericTypeConstructor(tpeTree.symbol.dri, data.asJava, null)
4747

4848
given TypeSyntax as AnyRef:
49-
extension (tpe: Type):
49+
extension (tpe: TypeRepr):
5050
def dokkaType(using ctx: reflect.Context): Bound =
5151
val data = inner(tpe)
5252
val dri = data.collect{
@@ -74,7 +74,7 @@ trait TypesSupport:
7474
tpeAnnotation.tpe.typeSymbol.toString == "class Repeated"
7575

7676
// TODO #23 add support for all types signatures that makes sense
77-
private def inner(tp: reflect.Type)(using cxt: reflect.Context): List[JProjection] =
77+
private def inner(tp: reflect.TypeRepr)(using cxt: reflect.Context): List[JProjection] =
7878
def noSupported(name: String): List[JProjection] =
7979
println(s"WARN: Unsupported type: $name: ${tp.show}")
8080
List(text(s"Unsupported[$name]"))
@@ -102,7 +102,7 @@ trait TypesSupport:
102102

103103

104104
case r: Refinement => { //(parent, name, info)
105-
def getRefinementInformation(t: Type): List[Type] = t match {
105+
def getRefinementInformation(t: TypeRepr): List[TypeRepr] = t match {
106106
case r: Refinement => getRefinementInformation(r.parent) :+ r
107107
case tr: TypeRef => List(tr)
108108
}
@@ -118,7 +118,7 @@ trait TypesSupport:
118118
.reduceLeftOption((acc: List[JProjection], elem: List[JProjection]) => acc ++ texts(", ") ++ elem).getOrElse(List())
119119
++ texts(")")
120120

121-
def parseRefinedElem(name: String, info: Type, polyTyped: List[JProjection] = Nil): List[JProjection] = ( info match {
121+
def parseRefinedElem(name: String, info: TypeRepr, polyTyped: List[JProjection] = Nil): List[JProjection] = ( info match {
122122
case m: MethodType => {
123123
val paramList = getParamList(m)
124124
texts(s"def $name") ++ polyTyped ++ paramList ++ texts(": ") ++ inner(m.resType)
@@ -137,7 +137,7 @@ trait TypesSupport:
137137
case other => noSupported(s"Not supported type in refinement $info")
138138
} ) ++ texts("; ")
139139

140-
def parsePolyFunction(info: Type): List[JProjection] = info match {
140+
def parsePolyFunction(info: TypeRepr): List[JProjection] = info match {
141141
case t: PolyType =>
142142
val paramBounds = getParamBounds(t)
143143
val method = t.resType.asInstanceOf[MethodType]
@@ -185,8 +185,8 @@ trait TypesSupport:
185185
case tp @ TypeRef(qual, typeName) =>
186186
qual match {
187187
case r: RecursiveThis => texts(s"this.$typeName")
188-
case _: Type | _: NoPrefix => link(tp.typeSymbol)
189-
case other => noSupported(s"Type: $tp")
188+
case _: TypeRepr | _: NoPrefix => link(tp.typeSymbol)
189+
case other => noSupported(s"TypeRepr: $tp")
190190
}
191191
// convertTypeOrBoundsToReference(reflect)(qual) match {
192192
// case TypeReference(label, link, xs, _) => TypeReference(typeName, link + "/" + label, xs, true)
@@ -248,7 +248,7 @@ trait TypesSupport:
248248

249249
case RecursiveType(tp) => inner(tp)
250250

251-
private def typeBound(t: Type, low: Boolean) =
251+
private def typeBound(t: TypeRepr, low: Boolean) =
252252
val ignore = if(low) t.typeSymbol == defn.NothingClass else t.typeSymbol == defn.AnyClass
253253
val prefix = text(if low then " >: " else " <: ")
254254
t match {

scala3doc/src/dotty/tools/dottydoc/Main.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import dotc.reporting.Reporter
1212
import dotc.{ Compiler, Driver }
1313
import dotc.config._
1414

15+
import dotty.tools.dotc.config.Settings.Setting.value
16+
1517
import java.io.File
1618

1719
/** Main object for SBT.
@@ -43,7 +45,7 @@ object Main extends Driver {
4345
}
4446

4547
val (filesToCompile, ctx) = setup(compilerArgs, rootCtx)
46-
given as Context = ctx
48+
given Context = ctx
4749

4850
// parse Dokka args
4951
// note: all required args should be set with SBT settings,

0 commit comments

Comments
 (0)