Skip to content

Can nature of dependency on scalac-compat be clarified?Β #793

@Thrillpool

Description

@Thrillpool

I notice that as of 2.13 (of cats-core), due to typelevel/cats@c442521#diff-7c156dc8732800194b79210cf462828782dcdf1b516cfc26f72afe892f8d279cR53, if you have like

class C extends cats.instances.AllInstances {}

and compile against scala 2.12, you get compilation error

[error] Symbol 'type org.typelevel.scalaccompat.annotation.unused' is missing from the classpath.
[error] This symbol is required by ' <none>'.
[error] Make sure that type unused is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'MapInstances.class' was compiled against an incompatible version of org.typelevel.scalaccompat.annotation.
[error] class C extends cats.instances.AllInstances {}

(actually in reality, the context I found this in was more a lot more confusing, scala compiler didn't at all point me to correct line or file causing the issue 😞 ).

Anyway, org.typelevel.scalaccompat.annotation.unused is indeed in scalasignature of MapInstances class, and reading https://github.com/typelevel/scalac-compat/blob/main/annotation/src/main/scala-2.12/org/typelevel/scalaccompat/annotation/unused.scala I guess this is all 'as intended'.

That's all /fine/ and scalac-compat is listed as provided dependency, and if you add it as dependency, OK my code example works.

Questions are

  1. Why is it provided dependency? To me looking through the 3 usages of scalaccompat in codebase it (naively) seems more like it should be that scalac-compat is compile dependency for 2.12, and not listed as dependency for other scala versions (in the poms).
  2. If it is to stay as provided dependency, should it be written down in some documentation that one needs to provide it when using scala 2.12, and probably noted in https://github.com/typelevel/cats/releases/tag/v2.13.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions