typelevel / typelevel/sbt-typelevel

Can nature of dependency on scalac-compat be clarified?

Open
#793 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
185
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I notice that as of 2.13 (of cats-core), due to https://github.com/typelevel/cats/commit/c44252155c3e38ffc8201db5b43c013f2bf41d08#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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the three scalac-compat usages and the generated dependency metadata for Scala 2.12 versus other Scala versions. Determine whether the provided dependency is intentional, then document the requirement and consider noting it in the v2.13.0 release information; done means the dependency behavior and user-facing guidance are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.