Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't constrain type variables in normalize #15223

Merged
merged 1 commit into from
May 19, 2022
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
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ object ProtoTypes {
else mt.derivedLambdaType(mt.paramNames, mt.paramInfos, rt)
case _ =>
val ft = defn.FunctionOf(mt.paramInfos, rt)
if (mt.paramInfos.nonEmpty || ft <:< pt) ft else rt
if mt.paramInfos.nonEmpty || (ft frozen_<:< pt) then ft else rt
}
}
case et: ExprType =>
Expand Down
13 changes: 13 additions & 0 deletions tests/pos/i15171.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
case class Expr[+T](get: T)
trait Ctx[F[_]]
sealed trait Selector[F[_]]:
def appended(base: Expr[SelectLoop[F]]): Expr[SelectLoop[F]]

// Without Ctx[F] argument it would compile correctly
class SelectLoop[F[_]](using Ctx[F])
object SelectLoop:
def loopImpl[F[_]](ctx: Ctx[F])(caseDefs: List[Selector[F]]): Expr[Unit] =
// Adding explicit type :Expr[SelectLoop[F]] satifies the compiler
val s0 = Expr(new SelectLoop[F](using ctx))
val g = caseDefs.foldRight(s0)(_.appended(_))
Expr(())