Skip to content

TypeError: object caps does not have a member type Cap #20556

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
GoogeTan opened this issue Jun 11, 2024 · 2 comments · Fixed by #20493
Closed

TypeError: object caps does not have a member type Cap #20556

GoogeTan opened this issue Jun 11, 2024 · 2 comments · Fixed by #20493

Comments

@GoogeTan
Copy link

Compiler version

Scala 3.4.2

Minimized code

https://github.com/GoogeTan/DottyCrashExample
I have tried to make it as small as possible. If last commit doesn't crash on your pc then try previous one.

Output (click arrow to expand)

scala: compiling 1 Scala source to D:\DottyCrashExample\layout\target\scala-3.4.2\classes ...
scala: 
  unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on D:\DottyCrashExample\layout\src\main\scala\DP.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 -Yno-enrich-error-messages.

     while compiling: D:\DottyCrashExample\layout\src\main\scala\DP.scala
        during phase: MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.2
            settings: -classpath D:\DottyCrashExample\layout\target\scala-3.4.2\classes;D:\DottyCrashExample\common\target\scala-3.4.2\classes;C:\Users\Googl\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-library\2.13.10\scala-library-2.13.10.jar;C:\Users\Googl\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala3-library_3\3.3.1\scala3-library_3-3.3.1.jar;C:\Users\Googl\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\typelevel\cats-core_3\2.10.0\cats-core_3-2.10.0.jar;C:\Users\Googl\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\typelevel\cats-kernel_3\2.10.0\cats-kernel_3-2.10.0.jar;C:\Users\Googl\AppData\Local\Coursier\cache\v1\https\repo1.maven.org\maven2\org\typelevel\cats-mtl_3\1.4.0\cats-mtl_3-1.4.0.jar -d D:\DottyCrashExample\layout\target\scala-3.4.2\classes

scala: ## Exception when compiling 1 sources to D:\DottyCrashExample\layout\target\scala-3.4.2\classes
dotty.tools.dotc.core.TypeError$$anon$1: object caps does not have a member type Cap

           
scala: Compilation failed when compiling to: D:\DottyCrashExample\layout\target\scala-3.4.2\classes
  object caps does not have a member type Cap
@GoogeTan GoogeTan added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 11, 2024
@som-snytt
Copy link
Contributor

som-snytt commented Jun 11, 2024

The build.sbt should say

libraryDependencies ++= defaultLibraries

instead of :=.

It is annoying that we must suffer typos the hard way.

Edit: without the jar dependency, that is, setting dependencies to nil, you get the friendlier:

[error] Could not find package scala from compiler core libraries.
[error] Make sure the compiler core libraries are on the classpath.
[error]
[error] (layout / Compile / compileIncremental) Compilation failed

@WojciechMazur
Copy link
Contributor

The cause of this cryptic error can be fixed using #20493

@Kordyjan Kordyjan added this to the 3.5.1 milestone Jul 3, 2024
@Gedochao Gedochao added area:opaque-types and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants