Skip to content

Commit 4a8812b

Browse files
authored
Rename membersOf to autowireMembersOf (#350)
1 parent ea3de81 commit 4a8812b

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ of the default construct/`apply` mechanism. These are described in detail below.
109109
* an instance to use
110110
* a function to create an instance
111111
* a class to instantiate to provide a dependency for the types it implements (provided as: `classOf[SomeType]`)
112-
* a `membersOf(instance)` call, to use the members of the given instance as dependencies
112+
* a `autowireMembersOf(instance)` call, to use the members of the given instance as dependencies
113113

114114
`autowire` is context-free: its result does not depend on the environment, within which it is called (except for
115115
implicit parameters, which are looked up using the usual mechanism). It only depends on the type that is specified
@@ -183,7 +183,7 @@ Without the `classOf[]`, MacWire wouldn't know how to create an instance impleme
183183

184184
## Using dependencies contained in objects
185185

186-
Finally, it's possible to use the members of a given instance as dependencies. Simply pass a `memberOf(someInstance)`
186+
Finally, it's possible to use the members of a given instance as dependencies. Simply pass a `autowireMembersOf(someInstance)`
187187
as a parameter to `autowire`.
188188

189189
## Errors

macros/src/main/scala-3/com/softwaremill/macwire/internals/autowire/AutowireProviders.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AutowireProviders[Q <: Quotes](using val q: Q)(
5555
else Vector.empty
5656

5757
val membersOfProviders =
58-
if term.show.startsWith("com.softwaremill.macwire.macwire$package.membersOf") then
58+
if term.show.startsWith("com.softwaremill.macwire.macwire$package.autowireMembersOf") then
5959
providersFromMembersOf(term)
6060
else Vector.empty
6161

macros/src/main/scala-3/com/softwaremill/macwire/macwire.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.softwaremill.macwire.internals.MacwireMacros
99
* - an instance to use
1010
* - a function to create an instance
1111
* - a class to instantiate to provide a dependency for the types it implements (provided as: `classOf[SomeType]`)
12-
* - a `membersOf(instance)` call, to use the members of the given instance as dependencies
12+
* - a `autowireMembersOf(instance)` call, to use the members of the given instance as dependencies
1313
*
1414
* Any missing dependenciess will be created using the publicly available primary constructors or apply methods.
1515
*
@@ -113,4 +113,4 @@ inline def wireRec[T]: T = ${ MacwireMacros.wireRecImpl[T] }
113113
/** Marker method to be used in [[autowire]], to specify that values defined in the given value should be used for
114114
* wiring.
115115
*/
116-
def membersOf[T](t: T): T = ???
116+
def autowireMembersOf[T](t: T): T = ???

tests/src/test/resources/test-cases/autowire/membersOf.success renamed to tests/src/test/resources/test-cases/autowire/autowireMembersOf.success

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Deps(val a: A, b: B):
66
case class C(a: A, b: B)
77

88
val d = new Deps(new A {}, new B {})
9-
val c = autowire[C](membersOf(d))
9+
val c = autowire[C](autowireMembersOf(d))
1010

1111
assert(c.a eq d.a)
1212
assert(c.b eq d.bb)

tests/src/test/resources/test-cases/autowire/membersOfDuplicate.failure renamed to tests/src/test/resources/test-cases/autowire/autowireMembersOfDuplicate.failure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ class Deps(val a: A, b: B):
66
case class C(a: A, b: B)
77

88
val d = new Deps(new A, new B)
9-
autowire[C](membersOf(d), new A)
9+
autowire[C](autowireMembersOf(d), new A)

tests/src/test/scala-3/com/softwaremill/macwire/AutowireCompileTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class AutowireCompileTests extends CompileTestsSupport:
1717
"cannot find a provided dependency, public constructor or public apply method for: A;",
1818
"wiring path: B -> A"
1919
),
20-
"membersOfDuplicate" -> List("duplicate type in dependencies list: A, for: new A()")
20+
"autowireMembersOfDuplicate" -> List("duplicate type in dependencies list: A, for: new A()")
2121
)
2222
)

0 commit comments

Comments
 (0)