Skip to content

Compiler crash in 3.7 nightly while compiling http4s-related code, "invalid new prefix" #22737

Closed as duplicate of#22727
@mrdziuban

Description

@mrdziuban

Compiler version

3.7.0-RC1-bin-20250306-73ba485-NIGHTLY

Minimized code

//> using dep org.http4s::http4s-core:0.23.30

import cats.effect.IO
import org.http4s.EntityBody

type Response = org.http4s.Response[IO]

extension (res: Response) {
  def withEntity(f: EntityBody[IO] => EntityBody[IO]): Response = res.copy(body = f(res.body))
}

Output

  unhandled exception while running MegaPhase{crossVersionChecks, firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs, elimRepeated, refchecks, dropForMap} on /Users/matt/scala3.7-http4s-crash/src/main/scala/example/Test.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.


     while compiling: /Users/matt/scala3.7-http4s-crash/src/main/scala/example/Test.scala
        during phase: MegaPhase{crossVersionChecks, firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs, elimRepeated, refchecks, dropForMap}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.16
    compiler version: version 3.7.0-RC1-bin-20250306-73ba485-NIGHTLY-git-73ba485
            settings: -classpath /Users/matt/scala3.7-http4s-crash/target/scala-3.7.0-RC1-bin-20250306-73ba485-NIGHTLY/classes:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.7.0-RC1-bin-20250306-73ba485-NIGHTLY/scala3-library_3-3.7.0-RC1-bin-20250306-73ba485-NIGHTLY.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/http4s-core_3/0.23.30/http4s-core_3-0.23.30.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.16/scala-library-2.13.16.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/case-insensitive_3/1.4.2/case-insensitive_3-1.4.2.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-core_3/2.11.0/cats-core_3-2.11.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-effect-std_3/3.5.7/cats-effect-std_3-3.5.7.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-parse_3/1.0.0/cats-parse_3-1.0.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/http4s-crypto_3/0.2.4/http4s-crypto_3-0.2.4.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/co/fs2/fs2-core_3/3.11.0/fs2-core_3-3.11.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/co/fs2/fs2-io_3/3.11.0/fs2-io_3-3.11.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/comcast/ip4s-core_3/3.6.0/ip4s-core_3-3.6.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/literally_3/1.1.0/literally_3-1.1.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scodec/scodec-bits_3/1.1.38/scodec-bits_3-1.1.38.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/vault_3/3.6.0/vault_3-3.6.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/log4s/log4s_3/1.10.0/log4s_3-1.10.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/log4cats-slf4j_3/2.7.0/log4cats-slf4j_3-2.7.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-kernel_3/2.11.0/cats-kernel_3-2.11.0.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-effect-kernel_3/3.5.7/cats-effect-kernel_3-3.5.7.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-effect_3/3.5.4/cats-effect_3-3.5.4.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:/Users/matt/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/log4cats-core_3/2.7.0/log4cats-core_3-2.7.0.jar -d /Users/matt/scala3.7-http4s-crash/target/scala-3.7.0-RC1-bin-20250306-73ba485-NIGHTLY/classes

## Exception when compiling 1 sources to /Users/matt/scala3.7-http4s-crash/target/scala-3.7.0-RC1-bin-20250306-73ba485-NIGHTLY/classes
dotty.tools.dotc.core.TypeError$$anon$1: invalid new prefix  = org.http4s.Response[cats.effect.IO] cannot replace (Message.this : org.http4s.Message[F] & org.http4s.Message[F]) in type Message.this.Self

Expectation

It should compile without any error, as in previous versions

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions