Skip to content

Typer regression in business4s/decisions4s #21981

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

Closed
WojciechMazur opened this issue Nov 19, 2024 · 0 comments · Fixed by #22697
Closed

Typer regression in business4s/decisions4s #21981

WojciechMazur opened this issue Nov 19, 2024 · 0 comments · Fixed by #22697
Assignees
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

Based on OpenCB failure in business4s/decisions4s - build logs

Compiler version

Last good release: 3.6.3-RC1-bin-20241111-b712447-NIGHTLY
First bad release: 3.6.3-RC1-bin-20241112-6f48c39-NIGHTLY
Bisect points to 0a04b68

Minimized code

object internal:
  trait Functor[F[_]] {
    extension [T](ft: F[T]) def map[T1](f: T => T1): F[T1]
  }

object cats:
  trait Functor[F[_]]
  object Functor:
    trait Ops[F[_], A]:
      def map[B](f: A => B): F[B] = ???
    def toAllFunctorOps[F[_], A](target: F[A])(using Functor[F]): Ops[F, A] = ???

given [F[_]](using cf: cats.Functor[F]): internal.Functor[F] with {
  extension [T](ft: F[T]) def map[T1](f: T => T1): F[T1] = ???
}

trait Ref[F[_], +T]
class MemoizingEvaluator[Input[_[_]], Output[_[_]], F[_]: cats.Functor] {
  type OptionRef[T] = Ref[F, Option[T]]

  def sequence[CaseClass[_[_]], G[_], H[_]](instance: CaseClass[[t] =>> G[H[t]]]): G[CaseClass[H]] = ???
  def collectValues(input: Input[F]): F[(Input[F], Input[OptionRef])] = {
    val refsF: Input[[t] =>> F[OptionRef[t]]] = ???
    for {
      refs <- cats.Functor.toAllFunctorOps(sequence[Input, F, OptionRef](refsF))
      updating = ???
    } yield (updating, refs)
  }
}

Output

-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala/sandbox/test.scala:27:13 ----------------------------------------------------------------------------------------------------------
27 |    } yield (updating, refs)
   |             ^^^^^^^^
   |             Found:    (updating : Any)
   |             Required: Input[F]
   |
   |             where:    F     is a type in class MemoizingEvaluator with bounds <: [_] =>> Any
   |                       Input is a type in class MemoizingEvaluator with bounds <: [_²[_$8]] =>> Any
   |
   | longer explanation available when compiling with `-explain`
-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala/sandbox/test.scala:27:23 ----------------------------------------------------------------------------------------------------------
27 |    } yield (updating, refs)
   |                       ^^^^
   |                       Found:    (refs : Any)
   |                       Required: Input[MemoizingEvaluator.this.OptionRef]
   |
   |                       where:    Input is a type in class MemoizingEvaluator with bounds <: [_[_$8]] =>> Any
   |
   | longer explanation available when compiling with `-explain`

Expectation

Should compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
2 participants