Skip to content

Typer regression for dependant types in multiple OpenCB projects #23056

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 Apr 27, 2025 · 2 comments · Fixed by #23060
Closed

Typer regression for dependant types in multiple OpenCB projects #23056

WojciechMazur opened this issue Apr 27, 2025 · 2 comments · Fixed by #23060
Assignees
Labels
area:typer itype:bug prio:blocker regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Apr 27, 2025

Based on OpenCB failure for armanbilge/calico - build logs.
OpenCB for 3.7.1-RC1-bin-20250424-99d640c-NIGHTLY failed for more 45 projects then 3.7.1-RC1-bin-20250417-05b102a-NIGHTLY It's likely that most of these are coused by the same regression.
Similar errors were observed in at least 15 projects in both Typelevel and ZIO ecosystems as well as vanilla Scala.

Compiler version

Last good release: 3.7.1-RC1-bin-20250417-05b102a-NIGHTLY
First bad release: 3.7.1-RC1-bin-20250424-99d640c-NIGHTLY
Bisect points to 2f285a2

Minimized code

def Test = {
  val ops: CompileOps[Option, Option, Any]  = ???
  ops.to(List).map(_.reverse) // error
}

trait CompileOps[F[_], G[_], O]:
  def to(collector: Collector[O]): G[collector.Out]
trait Collector[-A] {
  type Out
}

object Collector:
  type Aux[A, X] = Collector[A] { type Out = X }
  
  given [A, C[_]]: Conversion[
    scala.collection.IterableFactory[C],
    Collector.Aux[A, C[A]]
  ] = ???

Output

-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala/sandbox/test.scala:3:19 ---------------------------------------------------------------------------------------------------------
3 |  ops.to(List).map(_.reverse)
  |                   ^^^^^^^^^
  |                   Found:    ?1.Out => List[Any]
  |                   Required: ?2.Out => List[Any]
  |
  |                   where:    ?1 is an unknown value of type Collector.Aux[Any, List[Any]]
  |                             ?2 is an unknown value of type Collector.Aux[Any, List[Any]]

Expectation

@WojciechMazur WojciechMazur added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label regression This worked in a previous version but doesn't anymore labels Apr 27, 2025
@WojciechMazur WojciechMazur changed the title Typer regression in armanbilge/calico for dependant typer Typer regression for dependant types in multiple OpenCB projects Apr 27, 2025
@Gedochao Gedochao added area:typer and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 28, 2025
@Gedochao
Copy link
Contributor

cc @mbovel

@mbovel
Copy link
Member

mbovel commented Apr 28, 2025

ACK, I'll have a look today.

mbovel added a commit that referenced this issue Apr 28, 2025
Should fix #23056. I haven't been able to understand exactly what is
going on there yet, but the problem seems to arise in a situation where
the denotation should be reloaded during `integrate` and is not. This PR
makes sure that we keep the previous denotation for `NamedType` _only_
if its prefix is a `ParamRef` bound to the `LambdaType` we are
integrating over.
@WojciechMazur WojciechMazur added this to the 3.7.1 milestone May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug prio:blocker regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants