Skip to content

Commit 2ab03ae

Browse files
committed
Revert "Even hackier fix"
This reverts commit 1b2a5aa. I'll add next a test that breaks it.
1 parent 1b2a5aa commit 2ab03ae

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

compiler/src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -198,40 +198,6 @@ class TypeApplications(val self: Type) extends AnyVal {
198198
}
199199
}
200200

201-
// Argh, we'll need in fact multiple substitutions.
202-
final def typeParamsAndPrefix(maybePrefix: Type)(implicit ctx: Context): (List[TypeParamInfo], Type) = /*>|>*/ track("typeParams") /*<|<*/ {
203-
try self match {
204-
case self: TypeRef =>
205-
val tsym = self.symbol
206-
if (tsym.isClass) (tsym.typeParams, self.prefix)
207-
else if (!tsym.exists) self.info.typeParamsAndPrefix(self.prefix)
208-
else tsym.infoOrCompleter match {
209-
case info: LazyType =>
210-
(info.completerTypeParams(tsym), self.prefix) //XXX
211-
case info => info.typeParamsAndPrefix(self.prefix)
212-
}
213-
case self: AppliedType =>
214-
if (self.tycon.typeSymbol.isClass)
215-
(Nil, maybePrefix)
216-
else self.superType.typeParamsAndPrefix(maybePrefix)
217-
case self: ClassInfo =>
218-
(self.cls.typeParams, self)
219-
case self: HKTypeLambda =>
220-
(self.typeParams, maybePrefix)
221-
case _: SingletonType | _: RefinedType | _: RecType =>
222-
(Nil, maybePrefix)
223-
case self: WildcardType =>
224-
self.optBounds.typeParamsAndPrefix(maybePrefix)
225-
case self: TypeProxy =>
226-
self.superType.typeParamsAndPrefix(maybePrefix)
227-
case _ =>
228-
(Nil, maybePrefix)
229-
}
230-
catch {
231-
case ex: Throwable => handleRecursive("type parameters and prefix of", self.show, ex)
232-
}
233-
}
234-
235201
/** If `self` is a higher-kinded type, its type parameters, otherwise Nil */
236202
final def hkTypeParams(implicit ctx: Context): List[TypeParamInfo] =
237203
if (isLambdaSub) typeParams else Nil

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ object Checking {
7474
val AppliedTypeTree(tycon, args) = tree
7575
// If `args` is a list of named arguments, return corresponding type parameters,
7676
// otherwise return type parameters unchanged
77-
val (tparams, prefix) = tycon.tpe.typeParamsAndPrefix(tree.tpe)
77+
val tparams = kind(tycon.tpe).typeParams
7878
def argNamed(tparam: ParamInfo) = args.find {
7979
case NamedArg(name, _) => name == tparam.paramName
8080
case _ => false
8181
}.getOrElse(TypeTree(tparam.paramRef))
8282
val orderedArgs = if (hasNamedArg(args)) tparams.map(argNamed) else args
83-
val bounds = tparams.map(_.paramInfoAsSeenFrom(prefix.widen).bounds)
83+
val bounds = tparams.map(_.paramInfoAsSeenFrom(tree.tpe).bounds)
8484
def instantiate(bound: Type, args: List[Type]) =
8585
HKTypeLambda.fromParams(tparams, bound).appliedTo(args)
8686
if (boundsCheck) checkBounds(orderedArgs, bounds, instantiate)

0 commit comments

Comments
 (0)