Skip to content

Commit

Permalink
Minimalist attempt to reproduce scala 3 compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTheisens committed Sep 15, 2023
1 parent 76aa260 commit ae1f893
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
### SBT template
# Simple Build Tool
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control

dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
.history
.cache
.lib/

.idea/
.bsp/
1 change: 1 addition & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = 2.7.5
21 changes: 21 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
val scala3 = "3.3.0-RC1-bin-20221214-6383025-NIGHTLY"
lazy val `ReactiveMongo-Core` = project
.in(file("core"))
.settings(
name := "ReactiveMongo-Core",
description := "Example sbt project that compiles using Scala 3",
version := "0.1.0",
scalaVersion := scala3,
scalacOptions ++= Seq("-deprecation"),
)


lazy val `ReactiveMongo` = project
.in(file("driver"))
.settings(
name := "ReactiveMongo",
description := "Example sbt project that compiles using Scala 3",
version := "0.1.0",
scalaVersion := scala3,
scalacOptions ++= Seq("-deprecation"),
).dependsOn(`ReactiveMongo-Core`)
8 changes: 8 additions & 0 deletions core/src/main/scala-2/api/SerializationPackCompat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package reactivemongo.api

private[api] trait SerializationPackCompat {
_: Singleton with SerializationPack =>

val IdentityWriter: Writer[Document]
val IdentityReader: Reader[Document]
}
9 changes: 9 additions & 0 deletions core/src/main/scala-3/api/SerializationPackCompat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package reactivemongo.api


private[api] trait SerializationPackCompat {
_self: Singleton with SerializationPack =>

lazy val IdentityWriter: Writer[Document]
lazy val IdentityReader: Reader[Document]
}
10 changes: 10 additions & 0 deletions core/src/main/scala/api/GenericCollectionWithCommands.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package reactivemongo.api


trait SerializationPack extends SerializationPackCompat {
self: Singleton =>
type Value
type Document <: Value
type Writer[A]
type Reader[A]
}
5 changes: 5 additions & 0 deletions driver/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

@main
def Main(args: String*): Unit = {
println("hello world")
}
13 changes: 13 additions & 0 deletions driver/src/main/scala/api/GenericCollectionWithCommands.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package reactivemongo.api.collections

import collections.GenericCollection
import reactivemongo.api.SerializationPack





trait GenericCollectionWithCommands[P <: SerializationPack] {
self: GenericCollection[P] =>

}
13 changes: 13 additions & 0 deletions driver/src/main/scala/api/PackSupport.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package reactivemongo.api

trait PackSupport[P <: SerializationPack] {

/**
* The serialization pack ([[https://javadoc.io/doc/org.reactivemongo/reactivemongo-bson-api_2.12/latest/index.html BSON]] by default).
*
* Used to resolve the types of values
* (by default `BSONValue`, `BSONDocument`, ...), and the related typeclasses
* (e.g. `BSONDocumentReader` ...).
*/
val pack: P
}
14 changes: 14 additions & 0 deletions driver/src/main/scala/collections/GenericCollection.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package collections

import reactivemongo.api.PackSupport
import reactivemongo.api.SerializationPack
import reactivemongo.api.collections.GenericCollectionWithCommands

trait GenericCollection[P <: SerializationPack]
extends GenericCollectionWithCommands[P]
with PackSupport[P] {
self =>
private implicit def packIdentityWriter
: pack.Writer[pack.Document] =
pack.IdentityWriter
}
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.4

0 comments on commit ae1f893

Please sign in to comment.