File tree Expand file tree Collapse file tree 3 files changed +14
-13
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 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 {
182182 val tsym = self.symbol
183183 if (tsym.isClass) tsym.typeParams
184184 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
186196 case _ => self.info.typeParams
187197 }
188198 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
42814281
42824282 def adaptType (tp : Type ): Tree = {
42834283 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
42944285 else {
42954286 if (ctx.isJava)
42964287 // Cook raw type
Original file line number Diff line number Diff line change 11-- Warning: tests/neg-macros/quote-type-variable-no-inference-3.scala:5:22 ---------------------------------------------
225 | case '{ $_ : F[t, t]; () } => // warn // error
33 | ^
4- | Ignored bound <: Comparable[U ]
4+ | Ignored bound <: Comparable[Any ]
55 |
66 | Consider defining bounds explicitly:
7- | '{ type t <: Comparable[U ]; ... }
7+ | '{ type t <: Comparable[Any ]; ... }
88-- Warning: tests/neg-macros/quote-type-variable-no-inference-3.scala:6:49 ---------------------------------------------
996 | case '{ type u <: Comparable[`u`]; $_ : F[u, u] } =>
1010 | ^
You can’t perform that action at this time.
0 commit comments