Skip to content

compiler crash "dotty.tools.dotc.core.TypeError$$anon$1: due to previous compiler jars in classpath #19663

@philwalk

Description

@philwalk

Compiler version

# scalac -version
Scala compiler version 3.4.0-RC4 -- Copyright 2002-2024, LAMP/EPFL

This turned out to be a function of the classpath.
The minimum classpath for exhibiting the problem contains only the scala3-library_3-3.3.1.jar from a previous scala version.
This seems less like a bug than an error message that is likely to be confusing.

Minimized code

#!/usr/bin/env -S scala

object Main{
  def main(args: Array[String]): Unit = {
    val values = Seq.empty[String]
    val valcols: List[String] = values.size match {
      case 0 =>
        values.toList
      case num =>
        sys.error(s"bad list size: values[${values.toList}]\n")
    }
    valcols.mkString(",")
  }
}

Output (click arrow to expand)

  unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on C:\opt\ue\jsrc\dottyCrash.sc

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

     while compiling: C:\opt\ue\jsrc\dottyCrash.sc
        during phase: MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.0-RC4
            settings: -classpath C:/Users/philwalk/AppData/Local/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.1/scala3-library_3-3.3.1.jar;C:/opt/scala3-3.4.0-RC4/lib/scala-library-2.13.12.jar;C:/opt/scala3-3.4.0-RC4/lib/scala3-library_3-3.4.0-RC4.jar;C:/opt/scala3-3.4.0-RC4/lib/scala-asm-9.6.0-scala-1.jar;C:/opt/scala3-3.4.0-RC4/lib/compiler-interface-1.9.3.jar;C:/opt/scala3-3.4.0-RC4/lib/scala3-interfaces-3.4.0-RC4.jar;C:/opt/scala3-3.4.0-RC4/lib/scala3-compiler_3-3.4.0-RC4.jar;C:/opt/scala3-3.4.0-RC4/lib/tasty-core_3-3.4.0-RC4.jar;C:/opt/scala3-3.4.0-RC4/lib/scala3-staging_3-3.4.0-RC4.jar;C:/opt/scala3-3.4.0-RC4/lib/scala3-tasty-inspector_3-3.4.0-RC4.jar;C:/opt/scala3-3.4.0-RC4/lib/jline-reader-3.19.0.jar;C:/opt/scala3-3.4.0-RC4/lib/jline-terminal-3.19.0.jar;C:/opt/scala3-3.4.0-RC4/lib/jline-terminal-jna-3.19.0.jar;C:/opt/scala3-3.4.0-RC4/lib/jna-5.3.1.jar -d C:\tmp\scala3-scripting5883074577800132427

Exception in thread "main" dotty.tools.dotc.core.TypeError$$anon$1: object caps does not have a member type Cap

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions