Skip to content

Commit

Permalink
Merge pull request #91 from giiita/bugfix/container_multiple_curried_…
Browse files Browse the repository at this point in the history
…injection

Fix multiple curreied injection with implicit / given props
  • Loading branch information
giiita authored Jun 28, 2021
2 parents 8221c7b + 8920b7e commit 17151bd
Show file tree
Hide file tree
Showing 36 changed files with 2,495 additions and 1,999 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ node_modules
package-lock.json
.bsp
.metals
.vscode
.vscode
.bloop
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ At the moment, only refuel-container is supported for Scala3.
>
> All other refuel modules are based on refuel-container and will be ready to use.
## [refuel-util](https://github.com/giiita/refuel/tree/master/refuel-util)
## [refuel-util](https://github.com/giiita/refuel/tree/master/refuel-util) (Compatible with Scala3)

> Rich type class interfaces.<br/>
> Provides extended functions such as date and time, period, and collection.
Expand Down
21 changes: 10 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lazy val Scala2_12 = "2.12.14"
lazy val Scala2_13 = "2.13.6"
lazy val Scala3xx = "3.0.1-RC1"

scalaVersion in Scope.Global := Scala2_13
scalaVersion in Scope.Global := Scala3xx
releaseCrossBuild in Scope.Global := true
crossScalaVersions in Scope.Global := Seq(Scala2_12, Scala2_13)

Expand All @@ -24,7 +24,7 @@ lazy val typesafeConfigVersion = "1.4.1"

lazy val scala3PartialBuild = Def.settings(
crossScalaVersions := Seq(Scala2_12, Scala2_13, Scala3xx),
libraryDependencies in Scope.Global ++= Seq("org.scalatest" %% "scalatest" % "3.2.9" % Test) ++ {
libraryDependencies ++= Seq("org.scalatest" %% "scalatest" % "3.2.9" % Test) ++ {
CrossVersion
.partialVersion(scalaVersion.value) match {
case Some((2, y)) if y >= 13 =>
Expand Down Expand Up @@ -73,8 +73,8 @@ lazy val root = project
.in(file("."))
.aggregate(
`containerMacro`,
container
// util,
container,
util
// json,
// http,
// auth,
Expand Down Expand Up @@ -149,13 +149,12 @@ lazy val container = (project in file("refuel-container"))
),
Compile / unmanagedClasspath ++= (Compile / unmanagedResources).value
)
//lazy val util = (project in file("refuel-util"))
// .dependsOn(container)
// .settings(asemble)
// .settings(
// name := "refuel-util"
// )
// .enablePlugins(JavaAppPackaging)
lazy val util = (project in file("refuel-util"))
.dependsOn(container)
.settings(asemble, scala3PartialBuild)
.settings(
name := "refuel-util"
)
//lazy val json = (project in file("refuel-json"))
// .dependsOn(util)
// .settings(asemble)
Expand Down
20 changes: 20 additions & 0 deletions project/.bloop/bloop.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"semanticDBVersion": "4.4.20",
"supportedScalaVersions": [
"2.13.6",
"2.12.14",
"2.12.13",
"2.12.12",
"2.12.11",
"2.12.10",
"2.13.3",
"2.13.4",
"2.13.5",
"2.11.12",
"2.12.8",
"2.12.9",
"2.13.0",
"2.13.1",
"2.13.2"
]
}
2,240 changes: 2,240 additions & 0 deletions project/.bloop/refuel-build.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions project/metals.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// DO NOT EDIT! This file is auto-generated.
// This file enables sbt-bloop to create bloop config files.

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.8-19-4d9f966b")
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ object DependencyRankings {
}
val higher = candsPs.groupBy(_._1).foldLeft[Option[(c.Type, Iterable[(c.Type, c.Symbol)])]](None) { (a, b) =>
a.fold(Some(b)) { prev =>
// Exists super type
val maybe = prev._1.baseType(b._1.typeSymbol).orElse(b._1.baseType(prev._1.typeSymbol))
Some(if (maybe =:= prev._1) prev else b)
}
Expand All @@ -31,7 +32,7 @@ object DependencyRankings {
/* Injection priority config type tag */
private[this] def InjectionPriorityConfigType(c: blackbox.Context) = c.weakTypeOf[Inject[_]]

private[this] def DefaultType(c: blackbox.Context) = c.weakTypeOf[refuel.inject.InjectionPriority.Default.type]
private[this] def DefaultType(c: blackbox.Context) = c.weakTypeOf[refuel.inject.InjectionPriority.Default]

def generateExprOne(c: blackbox.Context)(samePriority: c.Symbol): c.Expr[_] = {
c.info(c.enclosingPosition, s"${samePriority.fullName} will be used.", true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package refuel.inject

import refuel.container.{Container, DependencyPoolRef}
import refuel.inject.Types.LocalizedContainer

/**
* [[AutoInject]] is subject to automatic loading by refuel.
Expand All @@ -25,4 +26,4 @@ import refuel.container.{Container, DependencyPoolRef}
* This annotation is an attribute for automatic injection, so
* it is not necessary when manually registering dependencies.
*/
trait AutoInject extends DependencyPoolRef[Container]
trait AutoInject extends DependencyPoolRef[LocalizedContainer]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object InjectableSymbolHandler {
def filterSymbols(c: blackbox.Context)(
symbols: Set[c.Symbol]
)(wtt: c.Type): Vector[c.Symbol] = {
val r = symbols
symbols
.filter {
case x if x.isModule =>
x.typeSignature <:< wtt
Expand All @@ -16,6 +16,5 @@ object InjectableSymbolHandler {
}
.toVector
.sortBy[String](_.fullName)
r
}
}
Loading

0 comments on commit 17151bd

Please sign in to comment.