summaryrefslogtreecommitdiff
path: root/test/files/neg/found-req-variance.check
blob: cc26458ac5e198b1442d9e0f90a0912a338c0242 (plain) (blame)
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
174
175
176
177
178
179
180
181
182
183
184
185
found-req-variance.scala:22: error: type mismatch;
 found   : Inv[B]
 required: Inv[A]
Note: B <: A, but class Inv is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
  def f2 = Set[Inv[A]]() + new Inv[B]
                           ^
found-req-variance.scala:23: error: type mismatch;
 found   : Inv[C]
 required: Inv[A]
Note: C <: A, but class Inv is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
  def f3 = Set[Inv[A]]() + new Inv[C]
                           ^
found-req-variance.scala:24: error: type mismatch;
 found   : Inv[A]
 required: Inv[B]
Note: A >: B, but class Inv is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
  def f4 = Set[Inv[B]]() + new Inv[A]
                           ^
found-req-variance.scala:26: error: type mismatch;
 found   : Inv[C]
 required: Inv[B]
Note: C <: B, but class Inv is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
  def f6 = Set[Inv[B]]() + new Inv[C]
                           ^
found-req-variance.scala:27: error: type mismatch;
 found   : Inv[A]
 required: Inv[C]
Note: A >: C, but class Inv is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
  def f7 = Set[Inv[C]]() + new Inv[A]
                           ^
found-req-variance.scala:28: error: type mismatch;
 found   : Inv[B]
 required: Inv[C]
Note: B >: C, but class Inv is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
  def f8 = Set[Inv[C]]() + new Inv[B]
                           ^
found-req-variance.scala:34: error: type mismatch;
 found   : MultiInv[A]
 required: Multi[A,B,C]
Note: A >: B (and MultiInv[A] <: Multi[A,A,C]), but class Multi is invariant in type Inv.
You may wish to define Inv as -Inv instead. (SLS 4.5)
  def g4 = Set[Multi[A, B, C]]() + new MultiInv[A]
                                   ^
found-req-variance.scala:36: error: type mismatch;
 found   : MultiInv[C]
 required: Multi[A,B,C]
Note: C <: B (and MultiInv[C] <: Multi[A,C,C]), but class Multi is invariant in type Inv.
You may wish to define Inv as +Inv instead. (SLS 4.5)
  def g6 = Set[Multi[A, B, C]]() + new MultiInv[C]
                                   ^
found-req-variance.scala:47: error: type mismatch;
 found   : FF1[A,A]
 required: FF1[B,B]
    def ff1 = f[B, B](h[A, A]) // fail
                       ^
found-req-variance.scala:48: error: type mismatch;
 found   : FF1[B,A]
 required: FF1[B,B]
    def ff2 = f[B, B](h[B, A]) // fail
                       ^
found-req-variance.scala:49: error: type mismatch;
 found   : FF1[C,A]
 required: FF1[B,B]
    def ff3 = f[B, B](h[C, A]) // fail
                       ^
found-req-variance.scala:50: error: type mismatch;
 found   : FF1[A,B]
 required: FF1[B,B]
Note: A >: B, but trait FF1 is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
    def ff4 = f[B, B](h[A, B]) // suggest
                       ^
found-req-variance.scala:52: error: type mismatch;
 found   : FF1[C,B]
 required: FF1[B,B]
Note: C <: B, but trait FF1 is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
    def ff6 = f[B, B](h[C, B]) // suggest
                       ^
found-req-variance.scala:53: error: type mismatch;
 found   : FF1[A,C]
 required: FF1[B,B]
Note: A >: B, but trait FF1 is invariant in type T.
You may wish to define T as -T instead. (SLS 4.5)
    def ff7 = f[B, B](h[A, C]) // suggest
                       ^
found-req-variance.scala:55: error: type mismatch;
 found   : FF1[C,C]
 required: FF1[B,B]
Note: C <: B, but trait FF1 is invariant in type T.
You may wish to define T as +T instead. (SLS 4.5)
    def ff9 = f[B, B](h[C, C]) // suggest
                       ^
found-req-variance.scala:61: error: type mismatch;
 found   : FF2[A,A]
 required: FF2[B,B]
Note: A >: B, but trait FF2 is invariant in type R.
You may wish to define R as -R instead. (SLS 4.5)
    def ff1 = f[B, B](h[A, A]) // suggest
                       ^
found-req-variance.scala:62: error: type mismatch;
 found   : FF2[B,A]
 required: FF2[B,B]
Note: A >: B, but trait FF2 is invariant in type R.
You may wish to define R as -R instead. (SLS 4.5)
    def ff2 = f[B, B](h[B, A]) // suggest
                       ^
found-req-variance.scala:63: error: type mismatch;
 found   : FF2[C,A]
 required: FF2[B,B]
    def ff3 = f[B, B](h[C, A]) // fail
                       ^
found-req-variance.scala:66: error: type mismatch;
 found   : FF2[C,B]
 required: FF2[B,B]
    def ff6 = f[B, B](h[C, B]) // fail
                       ^
found-req-variance.scala:67: error: type mismatch;
 found   : FF2[A,C]
 required: FF2[B,B]
Note: C <: B, but trait FF2 is invariant in type R.
You may wish to define R as +R instead. (SLS 4.5)
    def ff7 = f[B, B](h[A, C]) // suggest
                       ^
found-req-variance.scala:68: error: type mismatch;
 found   : FF2[B,C]
 required: FF2[B,B]
Note: C <: B, but trait FF2 is invariant in type R.
You may wish to define R as +R instead. (SLS 4.5)
    def ff8 = f[B, B](h[B, C]) // suggest
                       ^
found-req-variance.scala:69: error: type mismatch;
 found   : FF2[C,C]
 required: FF2[B,B]
    def ff9 = f[B, B](h[C, C]) // fail
                       ^
found-req-variance.scala:86: error: type mismatch;
 found   : java.util.ArrayList[String]
 required: java.util.List[AnyRef]
Note: String <: AnyRef, but Java-defined trait List is invariant in type E.
You may wish to investigate a wildcard type such as `_ <: AnyRef`. (SLS 3.2.10)
  def g1 = f[AnyRef](new java.util.ArrayList[String] { })
                     ^
found-req-variance.scala:87: error: type mismatch;
 found   : scala.math.Ordering[AnyRef]
 required: java.util.Comparator[String]
Note: AnyRef >: String, but Java-defined trait Comparator is invariant in type T.
You may wish to investigate a wildcard type such as `_ >: String`. (SLS 3.2.10)
  def g2 = g[String](Ordering.fromLessThan[AnyRef](_.toString < _.toString))
                                                  ^
found-req-variance.scala:94: error: type mismatch;
 found   : Misc.MyData
 required: Misc.Data[AnyVal]
Note: Int <: AnyVal (and Misc.MyData <: Misc.Data[Int]), but class Data is invariant in type A.
You may wish to define A as +A instead. (SLS 4.5)
  def f1 = Set[Data[AnyVal]]() + new MyData
                                 ^
found-req-variance.scala:100: error: type mismatch;
 found   : Set[String]
 required: Set[CharSequence]
Note: String <: CharSequence, but trait Set is invariant in type A.
You may wish to investigate a wildcard type such as `_ <: CharSequence`. (SLS 3.2.10)
    foo(s)
        ^
found-req-variance.scala:104: error: type mismatch;
 found   : Misc.Trippy[String,String,String]
 required: Misc.Trippy[Object,Object,Object]
Note: String <: Object, but class Trippy is invariant in type T2.
You may wish to define T2 as +T2 instead. (SLS 4.5)
  def g1 = Set[Trippy[AnyRef, AnyRef, AnyRef]]() + new Trippy[String, String, String]
                                                   ^
found-req-variance.scala:105: error: type mismatch;
 found   : scala.collection.immutable.Map[AnyRef,String]
 required: Map[String,String]
Note: AnyRef >: String, but trait Map is invariant in type A.
You may wish to investigate a wildcard type such as `_ >: String`. (SLS 3.2.10)
  def g2 = Set[Map[String, String]]() + Map[AnyRef, String]()
                                                           ^
28 errors found