Skip to content

Add ReactiveMongo-BSON to community-build #14188

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

Conversation

cchantep
Copy link
Contributor

No description provided.

@smarter
Copy link
Member

smarter commented Dec 30, 2021

[error] -- Error: /__w/dotty/dotty/community-build/community-projects/ReactiveMongo-BSON/api/src/main/scala-3/MacroImpl.scala:478:25 
[error] 478 |      val underlying = f(self)
[error]     |                         ^^^^
[error]     |Cannot prove that the value is fully initialized. May only use initialized value as arguments.

You should be able to reproduce this failure in your project locally by compiling with -Ysafe-init which is enabled by default in the community build, see https://dotty.epfl.ch/docs/reference/other-new-features/safe-initialization.html for more information (in particular it mentions that @unchecked can be used to suppress initialization checks if needed).

@cchantep cchantep force-pushed the task/community-build_reactivemongo-bson branch from dfcb95e to 4e7ff2a Compare December 31, 2021 15:04
@cchantep
Copy link
Contributor Author

Now failure seems unrelated:

Failed projects:
 - dotty.communitybuild.CommunityBuildTestA.zio

Also: #14195

@olhotak olhotak self-assigned this Jan 13, 2022
@olhotak
Copy link
Contributor

olhotak commented Jan 14, 2022

For projects such as this one that compile with fatal warnings, we disable the initialization checker by adding the following line in community-build/src/scala/dotty/communitybuild/projects.scala :

    scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init")

I tried to do this and re-enable the full project, but was blocked by two issues:

  • The project then has other errors unrelated to initialization checking.
  • I do not have permission to push commits to the branch underlying this PR.

The first error I get is:

[error] -- Error: /home/olhotak/git/dotty/community-build/community-projects/ReactiveMongo-BSON/geo/src/main/scala/Geometry.scala:36:18 
[error] 36 |    Macros.handler[GeoGeometry]
[error]    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]    |Exception occurred while executing macro expansion.
[error]    |scala.quoted.runtime.impl.ScopeException: Expression created in a splice was used outside of that splice.
[error]    |Created in: api/src/main/scala-3/MacroImpl.scala:533 at column 13
[error]    |Used in: api/src/main/scala-3/MacroImpl.scala:1642 at column 22
[error]    |Expr: forwardBSONWriter
[error]    |
[error]    |
[error]    |Creation stack:
[error]    |	api/src/main/scala-3/MacroImpl.scala:533 at column 13
[error]    |	api/src/main/scala-3/Macros.scala:222 at column 5
[error]    |
[error]    |
[error]    |Use stack:
[error]    |	api/src/main/scala-3/MacroImpl.scala:1642 at column 22
[error]    |	api/src/main/scala-3/Macros.scala:222 at column 5

@olhotak olhotak assigned cchantep and unassigned olhotak Jan 14, 2022
@smarter
Copy link
Member

smarter commented Jan 14, 2022

[error] |scala.quoted.runtime.impl.ScopeException: Expression created in a splice was used outside of that splice.

I assume this is because the community build is run with -Xcheck-macros, so this indicate a real problem in the original project

@cchantep
Copy link
Contributor Author

[error] |scala.quoted.runtime.impl.ScopeException: Expression created in a splice was used outside of that splice.

I assume this is because the community build is run with -Xcheck-macros, so this indicate a real problem in the original project

I disagree, as indicated in another issue, this option is raising false error.

@nicolasstucki
Copy link
Contributor

[error] |scala.quoted.runtime.impl.ScopeException: Expression created in a splice was used outside of that splice.

I assume this is because the community build is run with -Xcheck-macros, so this indicate a real problem in the original project

I disagree, as indicated in another issue, this option is raising false error.

With a quick look over MacroImpl.scala I saw that use usual QuotesHelper helper antipattern has used. This is most likely the cause of the failure as it decontextualizes the Quotes context by cashing some instances of it. Therefore all scopes are not correctly tracked causing the -XcheckMacros to fail and quadratic times when expanding quotes (to fix wrong owners).

The solution is to always pass the Quotes context as a context.

@cchantep cchantep closed this Jan 17, 2022
@cchantep cchantep deleted the task/community-build_reactivemongo-bson branch January 17, 2022 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants