File tree 3 files changed +14
-13
lines changed
compiler/src/dotty/tools/dotc
3 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,17 @@ class TypeApplications(val self: Type) extends AnyVal {
182
182
val tsym = self.symbol
183
183
if (tsym.isClass) tsym.typeParams
184
184
else tsym.infoOrCompleter match {
185
- case info : LazyType if isTrivial(self.prefix, tsym) => info.completerTypeParams(tsym)
185
+ case info : LazyType if isTrivial(self.prefix, tsym) =>
186
+ val tparams = info.completerTypeParams(tsym)
187
+ if tsym.isCompleted then tsym.info.typeParams
188
+ // Completers sometimes represent parameters as symbols where
189
+ // the completed type represents them as paramrefs. Make sure we get
190
+ // a stable result by calling `typeParams` recursively. Test case
191
+ // is pos/i19942.scala, where parameter F0 has initially a Namer#TypeDefCompleter.
192
+ // After calling its completerTypeParams, we get a list of parameter symbols
193
+ // and as a side effect F0 is completed. Calling typeParams on the completed
194
+ // type gives a list of paramrefs.
195
+ else tparams
186
196
case _ => self.info.typeParams
187
197
}
188
198
case self : AppliedType =>
Original file line number Diff line number Diff line change @@ -4281,16 +4281,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4281
4281
4282
4282
def adaptType (tp : Type ): Tree = {
4283
4283
val tree1 =
4284
- if pt eq AnyTypeConstructorProto then tree
4285
- else if tp.typeParamSymbols.isEmpty || tp.typeParamSymbols.isEmpty then
4286
- // call typeParamSymbols twice, to get the stable results
4287
- // (see also note inside typeParamSymbols)
4288
- // given `type LifecycleF = [_] =>> Any` in pos/i19942.scala
4289
- // with an Ident of LifecycleF, calling typeParams will return:
4290
- // 1. [type _] a list of the symbol _ in the type def tree, on the first call
4291
- // 2. [+_] a list of a lambda param, afterwards
4292
- // we only want to eta-expand if there are real type param symbols, so we check twice
4293
- tree
4284
+ if (pt eq AnyTypeConstructorProto ) || tp.typeParamSymbols.isEmpty then tree
4294
4285
else {
4295
4286
if (ctx.isJava)
4296
4287
// Cook raw type
Original file line number Diff line number Diff line change 1
1
-- Warning: tests/neg-macros/quote-type-variable-no-inference-3.scala:5:22 ---------------------------------------------
2
2
5 | case '{ $_ : F[t, t]; () } => // warn // error
3
3
| ^
4
- | Ignored bound <: Comparable[U ]
4
+ | Ignored bound <: Comparable[Any ]
5
5
|
6
6
| Consider defining bounds explicitly:
7
- | '{ type t <: Comparable[U ]; ... }
7
+ | '{ type t <: Comparable[Any ]; ... }
8
8
-- Warning: tests/neg-macros/quote-type-variable-no-inference-3.scala:6:49 ---------------------------------------------
9
9
6 | case '{ type u <: Comparable[`u`]; $_ : F[u, u] } =>
10
10
| ^
You can’t perform that action at this time.
0 commit comments