Skip to content
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

Annotations don't appear to unpickle correctly idk #10198

Closed
djspiewak opened this issue Nov 5, 2020 · 3 comments
Closed

Annotations don't appear to unpickle correctly idk #10198

djspiewak opened this issue Nov 5, 2020 · 3 comments

Comments

@djspiewak
Copy link

The error I get is as follows:

[error] undefined: new simulacrum.noop # 1982310: TermRef(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module simulacrum),noop),<init>) at sbt-api
[warn] sbt-api: Unhandled type class dotty.tools.dotc.core.Types$$anon$7 : <error undefined: new simulacrum.noop # 1982310: TermRef(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),module simulacrum),noop),<init>) at sbt-api>

You can reproduce this by attempting to build Cats Effect series/2.x branch against Cats 2.3.0-M1 removing the withDottyCompat on the dependencies. We originally thought this was because simulacrum-scalafix was being stripped from the Cats POM, but I removed that in this PR, published locally, and still see the above.

Just to push even further, I explicitly added "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.1" % Provided to the core libraryDependencies and it appears to have gotten further. I think I also have to add it to laws, but you see where this is going. It just generally appears that annotations, defined in Scala and published against Dotty, when used by an upstream project, do not correctly parse on the downstream project unless the annotation library is a direct dependency.

This is probably fixable by removing % Provided in the Cats build, but then simulacrum-scalafix is on everyone's classpath randomly.

@djspiewak
Copy link
Author

Oh, to make matters simpler, I'm relatively certain this can be reproduced with any project which depends on Cats, but I just happened to be working on CE.

@smarter
Copy link
Member

smarter commented Nov 6, 2020

We originally thought this was because simulacrum-scalafix was being stripped from the Cats POM, but I removed that in this PR, published locally, and still see the above.

You removed the pom-stripping but kept the % Provided so it's likely still missing from the classpath. My guess is that porting sbt/zinc#701 will fix this.

@djspiewak
Copy link
Author

You removed the pom-stripping but kept the % Provided so it's likely still missing from the classpath

I can confirm this is exactly the problem. Adding it to the laws project as well as core in CE resolves it downstream.

Just to be clear, this is a regression from Scala 2 behavior, where this kind of thing was fine. I do think magic comments would be better than annotations in this case. We'll probably workaround this in cats for the time being by just putting simulacrum on the transitive classpath.

@smarter smarter self-assigned this Nov 6, 2020
bishabosha added a commit that referenced this issue Nov 16, 2020
Fix #10198: Be robust against missing annotations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants