@@ -16,10 +16,6 @@ trait Substituters { this: Context =>
16
16
else tp.derivedSelect(subst(tp.prefix, from, to, theMap))
17
17
case _ : ThisType | NoPrefix =>
18
18
tp
19
- case tp : RefinedType => // @!!! remove
20
- tp.derivedRefinedType(subst(tp.parent, from, to, theMap), tp.refinedName, subst(tp.refinedInfo, from, to, theMap))
21
- case tp : TypeAlias =>
22
- tp.derivedTypeAlias(subst(tp.alias, from, to, theMap))
23
19
case _ =>
24
20
(if (theMap != null ) theMap else new SubstBindingMap (from, to))
25
21
.mapOver(tp)
@@ -34,10 +30,6 @@ trait Substituters { this: Context =>
34
30
else tp.derivedSelect(subst1(tp.prefix, from, to, theMap))
35
31
case _ : ThisType | _ : BoundType | NoPrefix =>
36
32
tp
37
- case tp : RefinedType =>
38
- tp.derivedRefinedType(subst1(tp.parent, from, to, theMap), tp.refinedName, subst1(tp.refinedInfo, from, to, theMap))
39
- case tp : TypeAlias =>
40
- tp.derivedTypeAlias(subst1(tp.alias, from, to, theMap))
41
33
case _ =>
42
34
(if (theMap != null ) theMap else new Subst1Map (from, to))
43
35
.mapOver(tp)
@@ -54,10 +46,6 @@ trait Substituters { this: Context =>
54
46
else tp.derivedSelect(subst2(tp.prefix, from1, to1, from2, to2, theMap))
55
47
case _ : ThisType | _ : BoundType | NoPrefix =>
56
48
tp
57
- case tp : RefinedType =>
58
- tp.derivedRefinedType(subst2(tp.parent, from1, to1, from2, to2, theMap), tp.refinedName, subst2(tp.refinedInfo, from1, to1, from2, to2, theMap))
59
- case tp : TypeAlias =>
60
- tp.derivedTypeAlias(subst2(tp.alias, from1, to1, from2, to2, theMap))
61
49
case _ =>
62
50
(if (theMap != null ) theMap else new Subst2Map (from1, to1, from2, to2))
63
51
.mapOver(tp)
@@ -79,10 +67,6 @@ trait Substituters { this: Context =>
79
67
else tp.derivedSelect(subst(tp.prefix, from, to, theMap))
80
68
case _ : ThisType | _ : BoundType | NoPrefix =>
81
69
tp
82
- case tp : RefinedType =>
83
- tp.derivedRefinedType(subst(tp.parent, from, to, theMap), tp.refinedName, subst(tp.refinedInfo, from, to, theMap))
84
- case tp : TypeAlias =>
85
- tp.derivedTypeAlias(subst(tp.alias, from, to, theMap))
86
70
case _ =>
87
71
(if (theMap != null ) theMap else new SubstMap (from, to))
88
72
.mapOver(tp)
@@ -112,10 +96,6 @@ trait Substituters { this: Context =>
112
96
}
113
97
case _ : ThisType | _ : BoundType | NoPrefix =>
114
98
tp
115
- case tp : RefinedType =>
116
- tp.derivedRefinedType(substDealias(tp.parent, from, to, theMap), tp.refinedName, substDealias(tp.refinedInfo, from, to, theMap))
117
- case tp : TypeAlias =>
118
- tp.derivedTypeAlias(substDealias(tp.alias, from, to, theMap))
119
99
case _ =>
120
100
(if (theMap != null ) theMap else new SubstDealiasMap (from, to))
121
101
.mapOver(tp)
@@ -151,10 +131,6 @@ trait Substituters { this: Context =>
151
131
tp
152
132
case _ : ThisType | _ : BoundType | NoPrefix =>
153
133
tp
154
- case tp : RefinedType =>
155
- tp.derivedRefinedType(substSym(tp.parent, from, to, theMap), tp.refinedName, substSym(tp.refinedInfo, from, to, theMap))
156
- case tp : TypeAlias =>
157
- tp.derivedTypeAlias(substSym(tp.alias, from, to, theMap))
158
134
case _ =>
159
135
(if (theMap != null ) theMap else new SubstSymMap (from, to))
160
136
.mapOver(tp)
@@ -169,10 +145,6 @@ trait Substituters { this: Context =>
169
145
else tp.derivedSelect(substThis(tp.prefix, from, to, theMap))
170
146
case _ : BoundType | NoPrefix =>
171
147
tp
172
- case tp : RefinedType =>
173
- tp.derivedRefinedType(substThis(tp.parent, from, to, theMap), tp.refinedName, substThis(tp.refinedInfo, from, to, theMap))
174
- case tp : TypeAlias =>
175
- tp.derivedTypeAlias(substThis(tp.alias, from, to, theMap))
176
148
case _ =>
177
149
(if (theMap != null ) theMap else new SubstThisMap (from, to))
178
150
.mapOver(tp)
@@ -187,10 +159,6 @@ trait Substituters { this: Context =>
187
159
else tp.derivedSelect(substRecThis(tp.prefix, from, to, theMap))
188
160
case _ : ThisType | _ : BoundType | NoPrefix =>
189
161
tp
190
- case tp : RefinedType =>
191
- tp.derivedRefinedType(substRecThis(tp.parent, from, to, theMap), tp.refinedName, substRecThis(tp.refinedInfo, from, to, theMap))
192
- case tp : TypeAlias =>
193
- tp.derivedTypeAlias(substRecThis(tp.alias, from, to, theMap))
194
162
case _ =>
195
163
(if (theMap != null ) theMap else new SubstRecThisMap (from, to))
196
164
.mapOver(tp)
@@ -205,10 +173,6 @@ trait Substituters { this: Context =>
205
173
else tp.derivedSelect(substParam(tp.prefix, from, to, theMap))
206
174
case _ : ThisType | NoPrefix =>
207
175
tp
208
- case tp : RefinedType =>
209
- tp.derivedRefinedType(substParam(tp.parent, from, to, theMap), tp.refinedName, substParam(tp.refinedInfo, from, to, theMap))
210
- case tp : TypeAlias =>
211
- tp.derivedTypeAlias(substParam(tp.alias, from, to, theMap))
212
176
case _ =>
213
177
(if (theMap != null ) theMap else new SubstParamMap (from, to))
214
178
.mapOver(tp)
@@ -223,10 +187,6 @@ trait Substituters { this: Context =>
223
187
else tp.derivedSelect(substParams(tp.prefix, from, to, theMap))
224
188
case _ : ThisType | NoPrefix =>
225
189
tp
226
- case tp : RefinedType =>
227
- tp.derivedRefinedType(substParams(tp.parent, from, to, theMap), tp.refinedName, substParams(tp.refinedInfo, from, to, theMap))
228
- case tp : TypeAlias =>
229
- tp.derivedTypeAlias(substParams(tp.alias, from, to, theMap))
230
190
case _ =>
231
191
(if (theMap != null ) theMap else new SubstParamsMap (from, to))
232
192
.mapOver(tp)
@@ -276,31 +236,4 @@ trait Substituters { this: Context =>
276
236
final class SubstParamsMap (from : BindingType , to : List [Type ]) extends DeepTypeMap {
277
237
def apply (tp : Type ) = substParams(tp, from, to, this )
278
238
}
279
-
280
- /** A map for "cycle safe substitutions" which do not force the denotation
281
- * of a TypeRef unless the name matches up with one of the substituted symbols.
282
- */
283
- final class SafeSubstMap (from : List [Symbol ], to : List [Type ]) extends TypeMap {
284
- def apply (tp : Type ): Type = tp match {
285
- case tp : NamedType =>
286
- try {
287
- var sym : Symbol = null
288
- var fs = from
289
- var ts = to
290
- while (fs.nonEmpty) {
291
- if (fs.head.name == tp.name) {
292
- if (sym == null ) sym = tp.symbol
293
- if (fs.head eq sym) return ts.head
294
- }
295
- fs = fs.tail
296
- ts = ts.tail
297
- }
298
- tp.withPrefix(apply(tp.prefix))
299
- }
300
- catch {
301
- case ex : CyclicReference => tp.derivedSelect(apply(tp.prefix))
302
- }
303
- case _ => mapOver(tp)
304
- }
305
- }
306
239
}
0 commit comments