Skip to content

Commit ae1f893

Browse files
committed
Minimalist attempt to reproduce scala 3 compile error
scala/scala3#18555 branch:
1 parent 76aa260 commit ae1f893

11 files changed

+111
-0
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
### SBT template
2+
# Simple Build Tool
3+
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
4+
5+
dist/*
6+
target/
7+
lib_managed/
8+
src_managed/
9+
project/boot/
10+
project/plugins/project/
11+
.history
12+
.cache
13+
.lib/
14+
15+
.idea/
16+
.bsp/

.scalafmt.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version = 2.7.5

build.sbt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
val scala3 = "3.3.0-RC1-bin-20221214-6383025-NIGHTLY"
2+
lazy val `ReactiveMongo-Core` = project
3+
.in(file("core"))
4+
.settings(
5+
name := "ReactiveMongo-Core",
6+
description := "Example sbt project that compiles using Scala 3",
7+
version := "0.1.0",
8+
scalaVersion := scala3,
9+
scalacOptions ++= Seq("-deprecation"),
10+
)
11+
12+
13+
lazy val `ReactiveMongo` = project
14+
.in(file("driver"))
15+
.settings(
16+
name := "ReactiveMongo",
17+
description := "Example sbt project that compiles using Scala 3",
18+
version := "0.1.0",
19+
scalaVersion := scala3,
20+
scalacOptions ++= Seq("-deprecation"),
21+
).dependsOn(`ReactiveMongo-Core`)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package reactivemongo.api
2+
3+
private[api] trait SerializationPackCompat {
4+
_: Singleton with SerializationPack =>
5+
6+
val IdentityWriter: Writer[Document]
7+
val IdentityReader: Reader[Document]
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package reactivemongo.api
2+
3+
4+
private[api] trait SerializationPackCompat {
5+
_self: Singleton with SerializationPack =>
6+
7+
lazy val IdentityWriter: Writer[Document]
8+
lazy val IdentityReader: Reader[Document]
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package reactivemongo.api
2+
3+
4+
trait SerializationPack extends SerializationPackCompat {
5+
self: Singleton =>
6+
type Value
7+
type Document <: Value
8+
type Writer[A]
9+
type Reader[A]
10+
}

driver/src/main/scala/Main.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
@main
3+
def Main(args: String*): Unit = {
4+
println("hello world")
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package reactivemongo.api.collections
2+
3+
import collections.GenericCollection
4+
import reactivemongo.api.SerializationPack
5+
6+
7+
8+
9+
10+
trait GenericCollectionWithCommands[P <: SerializationPack] {
11+
self: GenericCollection[P] =>
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package reactivemongo.api
2+
3+
trait PackSupport[P <: SerializationPack] {
4+
5+
/**
6+
* The serialization pack ([[https://javadoc.io/doc/org.reactivemongo/reactivemongo-bson-api_2.12/latest/index.html BSON]] by default).
7+
*
8+
* Used to resolve the types of values
9+
* (by default `BSONValue`, `BSONDocument`, ...), and the related typeclasses
10+
* (e.g. `BSONDocumentReader` ...).
11+
*/
12+
val pack: P
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package collections
2+
3+
import reactivemongo.api.PackSupport
4+
import reactivemongo.api.SerializationPack
5+
import reactivemongo.api.collections.GenericCollectionWithCommands
6+
7+
trait GenericCollection[P <: SerializationPack]
8+
extends GenericCollectionWithCommands[P]
9+
with PackSupport[P] {
10+
self =>
11+
private implicit def packIdentityWriter
12+
: pack.Writer[pack.Document] =
13+
pack.IdentityWriter
14+
}

project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.9.4

0 commit comments

Comments
 (0)