Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
case _: WildcardType => untpd.TypeTree()
case _ => untpd.TypeTree(tp)
}
pt match {
pt.stripTypeVar match {
case _ if defn.isNonDepFunctionType(pt) =>
// if expected parameter type(s) are wildcards, approximate from below.
// if expected result type is a wildcard, approximate from above.
Expand All @@ -711,6 +711,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
untpd.DependentTypeTree(syms => restpe.substParams(mt, syms.map(_.termRef)))
else
typeTree(restpe))
case tp: TypeParamRef =>
decomposeProtoFunction(ctx.typerState.constraint.entry(tp).bounds.hi, defaultArity)
case _ =>
(List.tabulate(defaultArity)(alwaysWildcardType), untpd.TypeTree())
}
Expand Down
7 changes: 7 additions & 0 deletions tests/pos/functions1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ object Functions {
val z: Spore[String, String] = x => x + x
val z2: Spore2[String, String] = x => x + x
}

object retType {
val a: List[() => 4] = List(() => 4)

class Inv[T]
val b: List[() => Inv[Int]] = List(() => new Inv)
}
}