forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathi4368.scala
173 lines (157 loc) · 2.6 KB
/
i4368.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
object Test1 {
trait X {
type A = B
type B
}
trait Y {
type A
type B = A
}
trait Z extends X with Y // error: cyclic
}
object Test2 {
trait W {
type A
type B
}
trait X { z: W =>
type A = z.B
type B
}
trait Y { z: W =>
type A
type B = z.A
}
trait Z extends X with Y // error: cyclic
}
object Test3 {
trait W {
type A
type B
}
trait X { z: W =>
type A = z.B
type B
}
trait Y { z: W =>
type A
type B = z.A
}
object App {
type Z = X with Y
val z: Z = z
val a: z.A = a // error: too deep
}
}
object Test4 {
trait X[F[_]] {
protected type A = F[B]
protected type B
}
trait Y[F[_]] {
protected type A
protected type B = F[A]
}
trait Fix[F[_]] extends X[F] with Y[F] {
type Result = A // error: too deep
}
}
object Test5 {
trait X {
type A = B
type B
}
trait Y {
type A
type B = A
}
object App {
type Z = X & Y
val z: Z = z
val a: z.A = a // error: too deep
}
}
object Test6 {
trait W { type T <: W; val t: T }
trait X {
type A = b.T
val a : A = b.t
type B <: W
val b : B
}
trait Y {
type A <: W
val a : A
type B = a.T
val b = a.t
}
trait Z extends X with Y // error: cyclic
}
object Test7 {
class Fix[F[_]] {
class Foo { type R >: F[T] <: F[T] } // error
type T = F[Foo#R]
}
object App {
type Nat = Fix[Option]#T
}
}
object Test8 {
class A {
type T = B#U // error: cyclic
}
class B {
type U = A#T
}
}
object Test9 {
trait W {
type A
}
trait X extends W {
type A = B
type B
}
trait Y extends W {
type A
type B = A
}
trait Foo[X <: W, Y <: W] {
type Z = X & Y
val z: Z
val a: z.A
}
trait Boo {
val f: Foo[X, Y]
}
trait Baz extends Boo {
val a = f.a // error: member search too deep
// this should be a cyclic error, but it goes undetected
// scalac reports a volatility error, but the dotty equivalent (checkRealizable)
// is checked too late.
}
}
object i4369 {
trait X { self =>
type R <: Z
type Z >: X { type R = self.R; type Z = self.R } // error: cyclic
}
class Foo extends X { type R = Foo; type Z = Foo } // error
}
object i4370 {
class Foo { type R = A }
type A = List[Foo#R] // error: cyclic
}
object i4371 {
class Foo { type A = Boo#B } // error: cyclic
class Boo { type B = Foo#A }
}
object i318 {
trait Y {
type A <: { type T >: B }
type B >: { type T >: A }
}
val y: Y = ???
val a: y.A = ??? // error: too deep
val b: y.B = a // error: too deep
}