Skip to content

Commit a6e24e4

Browse files
authored
Merge pull request #10660 from romanowski/scala3doc/member-migration
MIgrate away from Kotlin Documentable
2 parents 28f04c6 + 74c45cf commit a6e24e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1342
-836
lines changed

docs/docs/reference/new-types/polymorphic-function-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ println(e1) // Apply(Apply(Var(wrap),Var(f)),Apply(Var(wrap),Var(a)))
8080
### Relationship With Type Lambdas
8181

8282
Polymorphic function types are not to be confused with
83-
[_type lambdas_](new-types/type-lambdas.md).
83+
[_type lambdas_](type-lambdas.md).
8484
While the former describes the _type_ of a polymorphic _value_,
8585
the latter is an actual function value _at the type level_.
8686

project/Build.scala

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,14 @@ object Build {
15651565
generateDocumentation(
15661566
classDirectory.in(Compile).value.getAbsolutePath,
15671567
"scala3doc", "scala3doc/output/self", VersionUtil.gitHash,
1568-
"-siteroot scala3doc/documentation -project-logo scala3doc/documentation/logo.svg")
1568+
"-siteroot scala3doc/documentation -project-logo scala3doc/documentation/logo.svg " +
1569+
"-external-mappings " + raw".*scala.*" + "::" +
1570+
"scala3doc" + "::" +
1571+
"http://dotty.epfl.ch/api/" + ":::" +
1572+
raw".*java.*" + "::" +
1573+
"javadoc" + "::" +
1574+
"https://docs.oracle.com/javase/8/docs/api/"
1575+
)
15691576
}.value,
15701577

15711578
generateScala3Documentation := Def.inputTaskDyn {
@@ -1589,7 +1596,11 @@ object Build {
15891596
IO.write(dest / "CNAME", "dotty.epfl.ch")
15901597
}.dependsOn(generateDocumentation(
15911598
roots, "Scala 3", dest.getAbsolutePath, "master",
1592-
"-comment-syntax wiki -siteroot scala3doc/scala3-docs -project-logo scala3doc/scala3-docs/logo.svg"))
1599+
"-comment-syntax wiki -siteroot scala3doc/scala3-docs -project-logo scala3doc/scala3-docs/logo.svg " +
1600+
"-external-mappings " + raw".*java.*" + "::" +
1601+
"javadoc" + "::" +
1602+
"https://docs.oracle.com/javase/8/docs/api/"
1603+
))
15931604
}.evaluated,
15941605

15951606
generateTestcasesDocumentation := Def.taskDyn {

scala3doc-testcases/src/tests/extensionMethodSignatures.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class ClassOne
1717
extension (c: ClassTwo)
1818
def |||:(a: Int, b: Int, d: Int)(e: String): Int
1919
= 56
20+
def ++:(a: Int): Int
21+
= 45
2022

2123
extension (b: Int)
2224
def secondGroup(): String

scala3doc-testcases/src/tests/givenSignatures.scala

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,15 @@ package tests
22

33
package givenSignatures
44

5+
object Obj
56

7+
given Seq[String] = Nil
68

7-
class GivenClass {
8-
trait B
9-
trait C[T]
10-
val r: Int = 5
11-
type R = Int
12-
given R = r
13-
trait Ord[T] {
14-
def compare(x: T, y: T): Int
15-
extension (x: T) def < (y: T) = compare(x, y) < 0
16-
extension (x: T) def > (y: T) = compare(x, y) > 0
17-
}
18-
given intOrd: Ord[Int] with {
19-
def compare(x: Int, y: Int) =
20-
if (x < y) -1 else if (x > y) +1 else 0
21-
}
9+
given GivenType = GivenType()
2210

23-
given asd(using int: Int): B with {}
11+
class GivenType
2412

25-
given asd2[T]: C[T] with {}
26-
27-
given listOrd[T](using ord: Ord[T]): Ord[List[T]] with {
28-
29-
def compare(xs: List[T], ys: List[T]): Int = (xs, ys) match
30-
case (Nil, Nil) => 0
31-
case (Nil, _) => -1
32-
case (_, Nil) => +1
33-
case (x :: xs1, y :: ys1) =>
34-
val fst = ord.compare(x, y)
35-
if (fst != 0) fst else compare(xs1, ys1)
36-
}
37-
38-
given IntOps: Int.type = Int
39-
40-
given GivenType = GivenType()
41-
42-
class GivenType
43-
}
13+
trait Ord[T]
4414

15+
given listOrd[T](using ord: Ord[T]): Ord[List[T]]
16+
= ???
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package tests
2+
3+
package givenSignaturesPg
4+
5+
6+
7+
class GivenClass {
8+
trait B
9+
trait C[T]
10+
val r: Int = 5
11+
type R = Int
12+
given R = r
13+
trait Ord[T] {
14+
def compare(x: T, y: T): Int
15+
extension (x: T) def < (y: T) = compare(x, y) < 0
16+
extension (x: T) def > (y: T) = compare(x, y) > 0
17+
}
18+
given intOrd: Ord[Int] with {
19+
def compare(x: Int, y: Int) =
20+
if (x < y) -1 else if (x > y) +1 else 0
21+
}
22+
23+
given asd(using int: Int): B with {}
24+
25+
given asd2[T]: C[T] with {}
26+
27+
given listOrd[T](using ord: Ord[T]): Ord[List[T]] with {
28+
29+
def compare(xs: List[T], ys: List[T]): Int = (xs, ys) match
30+
case (Nil, Nil) => 0
31+
case (Nil, _) => -1
32+
case (_, Nil) => +1
33+
case (x :: xs1, y :: ys1) =>
34+
val fst = ord.compare(x, y)
35+
if (fst != 0) fst else compare(xs1, ys1)
36+
}
37+
38+
given IntOps: Int.type = Int
39+
40+
given GivenType = GivenType()
41+
42+
class GivenType
43+
}
44+

scala3doc-testcases/src/tests/methodsAndConstructors.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,10 @@ class Methods:
4747

4848
def arrays(a: Array[String], b: Array[Int]): Array[Double]
4949
= ???
50+
51+
def rightA1(a: Int): Int
52+
= ???
53+
54+
def ++:(a: Int)(b: Double): Int
55+
= ???
56+

scala3doc-testcases/src/tests/modifiersSignatureTestSource.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ abstract class Methods()
2424

2525
implicit def toImplicitString(): String
2626
= "asd"
27+
28+
inline def method2(inline name: String): String
29+
= "ala"
2730
}
2831

2932
class ImplementedMethods() extends Methods/*<-*/()/*->*/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package tests.nestingDRI
2+
3+
trait TestClass
4+
5+
class A:
6+
class B
7+
object B:
8+
object C
9+
class C:
10+
object D
11+
12+
13+
class AA:
14+
object B:
15+
class C:
16+
object D
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def toplevelDef = 123
2+
3+
class ToplevelClass

scala3doc/resources/dotty_res/scripts/ux.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ window.addEventListener("DOMContentLoaded", () => {
55
document.getElementById("leftColumn").classList.toggle("open");
66
};
77
}
8+
9+
var elements = document.getElementsByClassName("documentableElement")
10+
if (elements) {
11+
for (i = 0; i < elements.length; i++) {
12+
elements[i].onclick = function(){
13+
this.classList.toggle("expand")
14+
}
15+
}
16+
}
17+
18+
19+
if (location.hash) {
20+
var selected = document.getElementById(location.hash.substring(1));
21+
if (selected){
22+
selected.classList.toggle("expand");
23+
}
24+
}
25+
826
var logo = document.getElementById("logo");
927
if (logo) {
1028
logo.onclick = function() {

0 commit comments

Comments
 (0)