Skip to content

Non-deterministic compiler output #3264

@memo33

Description

@memo33

The scalac compiler generates non-deterministic .class files whenever zio.http.Client is used, possibly caused by izumi-reflect.

To reproduce
Compiling the following code from scratch twice generates class files that are not binary identical.

object ExampleA {
  def createClient: zio.ZLayer[Any, Throwable, zio.http.Client] =
    zio.http.Client.default
      .map(_.update[zio.http.Client](c => c))
}

(tested with Scala 3.4.2, zio-http 3.0.1, zio 2.1.9, izumi-reflect 2.3.9)

Expected behavior
The compiler output should be deterministic.

Additional context
Comparing the class files with javap -v suggests that this is possibly caused by izumi.reflect.Tag producing inconsistent results for ZClient. For example, the following produces different hashcodes after every compiler run, so equality would seem to be broken:

implicitly[izumi.reflect.Tag[zio.http.Client]].hashCode

I'm not sure if the ZClient type falls under one of the known limitations of izumi-reflect or not, so it might also be a bug upstream.

Are there any workarounds to get determinstic output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions