Skip to content

Commit fe0f685

Browse files
committed
scaladoc: type rendering fixes and improvements
1 parent d4a8600 commit fe0f685

12 files changed

+446
-161
lines changed

scaladoc-testcases/src/tests/exports1.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ class A: //unexpected
1414
= 1
1515
var aVar1: 1
1616
= 1
17-
type HKT[T[_], X] //expected: final type HKT = [T[_], X] =>> HKT[T, X]
17+
type HKT[T[_], X] //expected: final type HKT = [T[_], X] =>> a.HKT[T, X]
1818
= T[X]
19-
type SomeRandomType = (List[_] | Seq[_]) & String //expected: final type SomeRandomType = SomeRandomType
20-
def x[T[_], X](x: X): HKT[T, X]
19+
type SomeRandomType = (List[_] | Seq[_]) & String //expected: final type SomeRandomType = a.SomeRandomType
20+
def x[T[_], X](x: X): HKT[T, X] //expected: def x[T[_], X](x: X): A#HKT[T, X]
2121
= ???
2222
def fn[T, U]: T => U
2323
= ???
2424
object Object //expected: val Obj: Object.type
25-
val x: HKT[List, Int]
25+
val x: HKT[List, Int] //expected: val x: A#HKT[List, Int]
2626
= ???
27-
class Class(val a: Int, val b: Int) extends Serializable //expected: final type Class = Class
28-
enum Enum: //expected: final type Enum = Enum
27+
class Class(val a: Int, val b: Int) extends Serializable //expected: final type Class = a.Class
28+
enum Enum: //expected: final type Enum = a.Enum
2929
case A
3030
case B(i: Int)
3131
case C[T]() extends Enum

scaladoc-testcases/src/tests/functionTypeSignatures.scala

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ package tests.functionTypeSignatures
22

33
type A = ((Int, Int)) => Int
44

5-
type B = (Int | String) => Int
5+
type B = (Int | String) => Int //expected: type B = Int | String => Int
66

7-
type C = (Int & String) => Int
7+
type B1 = Int | String => Int
8+
9+
type C = (Int & String) => Int //expected: type C = Int & String => Int
10+
11+
type C1 = Int & String => Int
12+
13+
type D = Int | (String => Int)
814

915
type E = (A => B) => B
1016

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
package tests
2+
package infixTypes
3+
4+
import annotation.showAsInfix
5+
6+
@showAsInfix
7+
trait SomeTrait[A, B]
8+
9+
trait SomeTrait2[A, B]
10+
11+
def someTrait1[C, D]: C SomeTrait D
12+
= ???
13+
14+
def someTrait2[E, F]: SomeTrait[E, F] //expected: def someTrait2[E, F]: E SomeTrait F
15+
= ???
16+
17+
def someTrait3[G, H]: G SomeTrait2 H //expected: def someTrait3[G, H]: SomeTrait2[G, H]
18+
= ???
19+
20+
trait +++[A, B]
21+
22+
trait ++:[A, B]
23+
24+
trait ***[A, B]
25+
26+
trait **:[A, B]
27+
28+
def foo[A, B, C, D]: (A SomeTrait B) +++ (C SomeTrait2 D) //expected: def foo[A, B, C, D]: (A SomeTrait B) +++ SomeTrait2[C, D]
29+
= ???
30+
31+
// left-associative, same precedence
32+
33+
def a0[X, Y, Z]: X +++ Y +++ Z
34+
= a1
35+
36+
def a1[X, Y, Z]: (X +++ Y) +++ Z //expected: def a1[X, Y, Z]: X +++ Y +++ Z
37+
= a0
38+
39+
def a2[X, Y, Z]: X +++ (Y +++ Z)
40+
= ???
41+
42+
// right-associative, same precedence
43+
44+
def a3[X, Y, Z]: X ++: Y ++: Z
45+
= ???
46+
47+
def a4[X, Y, Z]: (X ++: Y) ++: Z
48+
= ???
49+
50+
def a5[X, Y, Z]: X ++: (Y ++: Z) //expected: def a3[X, Y, Z]: X ++: Y ++: Z
51+
= ???
52+
53+
// left and right associative, same precedence
54+
55+
def a6[X, Y, Z]: (X +++ Y) ++: Z
56+
= ???
57+
58+
def a7[X, Y, Z]: X +++ (Y ++: Z)
59+
= ???
60+
61+
// left-associative, mixed precedence
62+
63+
def b0[X, Y, Z]: X +++ Y *** Z
64+
= ???
65+
66+
def b1[X, Y, Z]: (X +++ Y) *** Z
67+
= ???
68+
69+
def b2[X, Y, Z]: X +++ (Y *** Z) //expected: def b2[X, Y, Z]: X +++ Y *** Z
70+
= ???
71+
72+
def b3[X, Y, Z]: X *** Y +++ Z
73+
= ???
74+
75+
def b4[X, Y, Z]: (X *** Y) +++ Z //expected: def b4[X, Y, Z]: X *** Y +++ Z
76+
= ???
77+
78+
def b5[X, Y, Z]: X *** (Y +++ Z)
79+
= ???
80+
81+
// right-associative, mixed precedence
82+
83+
def c0[X, Y, Z]: X ++: Y **: Z
84+
= ???
85+
86+
def c1[X, Y, Z]: (X ++: Y) **: Z
87+
= ???
88+
89+
def c2[X, Y, Z]: X ++: (Y **: Z) //expected: def c2[X, Y, Z]: X ++: Y **: Z
90+
= ???
91+
92+
def c3[X, Y, Z]: X **: Y ++: Z
93+
= ???
94+
95+
def c4[X, Y, Z]: (X **: Y) ++: Z //expected: def c4[X, Y, Z]: X **: Y ++: Z
96+
= ???
97+
98+
def c5[X, Y, Z]: X **: (Y ++: Z)
99+
= ???
100+
101+
// left and right associative, mixed precedence
102+
103+
def d0[X, Y, Z]: X +++ Y **: Z
104+
= ???
105+
106+
def d1[X, Y, Z]: (X +++ Y) **: Z
107+
= ???
108+
109+
def d2[X, Y, Z]: X +++ (Y **: Z) //expected: def d2[X, Y, Z]: X +++ Y **: Z
110+
= ???
111+
112+
def d3[X, Y, Z]: X *** Y ++: Z
113+
= ???
114+
115+
def d4[X, Y, Z]: (X *** Y) ++: Z //expected: def d4[X, Y, Z]: X *** Y ++: Z
116+
= ???
117+
118+
def d5[X, Y, Z]: X *** (Y ++: Z) //expected: def d5[X, Y, Z]: X *** (Y ++: Z)
119+
= ???
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package tests
2+
package matchTypeTuple
3+
4+
// issue 16084
5+
6+
sealed trait TupleTest[Take[_, _], Drop[_, _]]:
7+
type Split[T <: Tuple, N <: Int] = (Take[T, N], Drop[T, N])
8+
9+
inline def splitAt[This <: Tuple](n: Int): Split[This, n.type]
10+
= ???
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package tests
2+
package pathDependentTypes
3+
4+
import deriving.Mirror.ProductOf
5+
6+
// issue 16143
7+
8+
trait Foo[A]:
9+
type Out
10+
11+
trait Bar[A]:
12+
type Out
13+
14+
def foo[A](using f: Foo[A])(using b: Bar[f.Out]): b.Out
15+
= ???
16+
17+
// issue 16057
18+
19+
def fromProductTyped[P <: Product](p: P)(using m: ProductOf[P]): m.MirroredElemTypes
20+
= ???
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package tests
2+
package supertypeParamsSubstitution
3+
4+
class MyIter[A, CC[_], C]:
5+
def foo: A
6+
= ???
7+
def bar: CC[CC[A]]
8+
= ???
9+
def baz: C
10+
= ???
11+
12+
class MyList[T] extends MyIter[T, MyList, MyList[T]]
13+
//expected: def foo: T
14+
//expected: def bar: MyList[MyList[T]]
15+
//expected: def baz: MyList[T]
16+
17+
class MyListInt extends MyList[Int]
18+
//expected: def foo: Int
19+
//expected: def bar: MyList[MyList[Int]]
20+
//expected: def baz: MyList[Int]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package tests
2+
package thisType
3+
4+
// issue 16024
5+
6+
class X[Map[_, _[_]]]:
7+
inline def map[F[_]](f: [t] => t => F[t]): Map[this.type, F] = //expected: inline def map[F[_]](f: [t] => (x$1: t) => F[t]): Map[this.type, F]
8+
???

0 commit comments

Comments
 (0)