@@ -170,17 +170,20 @@ class TypeApplications(val self: Type) extends AnyVal {
170
170
/** The type arguments of this type's base type instance wrt.`base`.
171
171
* Existential types in arguments are disallowed.
172
172
*/
173
- final def baseArgTypes (base : Symbol )(implicit ctx : Context ): List [Type ] = baseArgInfos(base) mapConserve noBounds
173
+ final def baseArgTypes (base : Symbol )(implicit ctx : Context ): List [Type ] =
174
+ baseArgInfos(base) mapConserve noBounds
174
175
175
176
/** The type arguments of this type's base type instance wrt.`base`.
176
177
* Existential types in arguments are approximanted by their lower bound.
177
178
*/
178
- final def baseArgTypesLo (base : Symbol )(implicit ctx : Context ): List [Type ] = baseArgInfos(base) mapConserve boundsToLo
179
+ final def baseArgTypesLo (base : Symbol )(implicit ctx : Context ): List [Type ] =
180
+ baseArgInfos(base) mapConserve boundsToLo
179
181
180
182
/** The type arguments of this type's base type instance wrt.`base`.
181
183
* Existential types in arguments are approximanted by their upper bound.
182
184
*/
183
- final def baseArgTypesHi (base : Symbol )(implicit ctx : Context ): List [Type ] = baseArgInfos(base) mapConserve boundsToHi
185
+ final def baseArgTypesHi (base : Symbol )(implicit ctx : Context ): List [Type ] =
186
+ baseArgInfos(base) mapConserve boundsToHi
184
187
185
188
/** The first type argument of the base type instance wrt `base` of this type */
186
189
final def firstBaseArgInfo (base : Symbol )(implicit ctx : Context ): Type = base.typeParams match {
@@ -193,8 +196,11 @@ class TypeApplications(val self: Type) extends AnyVal {
193
196
/** The base type including all type arguments of this type.
194
197
* Existential types in arguments are returned as TypeBounds instances.
195
198
*/
196
- final def baseTypeWithArgs (base : Symbol )(implicit ctx : Context ): Type =
197
- self.baseTypeRef(base).appliedTo(baseArgInfos(base))
199
+ final def baseTypeWithArgs (base : Symbol )(implicit ctx : Context ): Type = self.dealias match {
200
+ case AndType (tp1, tp2) => tp1.baseTypeWithArgs(base) & tp2.baseTypeWithArgs(base)
201
+ case OrType (tp1, tp2) => tp1.baseTypeWithArgs(base) | tp2.baseTypeWithArgs(base)
202
+ case _ => self.baseTypeRef(base).appliedTo(baseArgInfos(base))
203
+ }
198
204
199
205
/** Translate a type of the form From[T] to To[T], keep other types as they are.
200
206
* `from` and `to` must be static classes, both with one type parameter, and the same variance.
@@ -205,7 +211,7 @@ class TypeApplications(val self: Type) extends AnyVal {
205
211
else self
206
212
207
213
/** If this is an encoding of a (partially) applied type, return its arguments,
208
- * otherwise return Nil.
214
+ * otherwise return Nil.
209
215
* Existential types in arguments are returned as TypeBounds instances.
210
216
*/
211
217
final def argInfos (implicit ctx : Context ): List [Type ] = {
0 commit comments