Repository: square/anvil (kotlin)

Issue:
Anvil generates AssistedInject with `create` instead of defined method name
This AssistedFactory generates differently to Dagger on Anvil 2.2.x with Dagger 2.32 or 2.34.x. (I've tried downgrading to 2.1.0 and 2.31.2 with the same issue)

Anvil defaults to just using `create` instead of reading the `@AssistedFactory` method name, in this case `build()`

```
class OrderItemChangeNotifier
@AssistedInject constructor(
    @Assisted private val activity: Activity,
    private val offlineApi: OfflineMode,
    private val orderItemChangeRelay: Relay<OrderItemChangeEvent>,
    private val featureApi: ISFeatureApi,
) {
    @AssistedFactory
    interface Factory {
        fun build(activity: Activity): OrderItemChangeNotifier
    }
}
```

```
e: build/anvil/src-gen-debug/.../OrderItemChangeNotifier_Factory_Impl.kt: (14, 8): Class 'OrderItemChangeNotifier_Factory_Impl' is not abstract and does not implement abstract member public abstract fun build(activity: Activity): OrderItemChangeNotifier defined in ....OrderItemChangeNotifier.Factory
e: build/anvil/src-gen-debug/.../OrderItemChangeNotifier_Factory_Impl.kt: (17, 10): 'create' overrides nothing
```


```
import android.app.Activity
import <our.package>.OrderItemChangeNotifier_Factory
import dagger.`internal`.InstanceFactory
import javax.inject.Provider
import kotlin.Suppress
import kotlin.jvm.JvmStatic

public class OrderItemChangeNotifier_Factory_Impl(
  private val delegateFactory: OrderItemChangeNotifier_Factory
) : OrderItemChangeNotifier.Factory {
  public override fun create(activity: Activity): OrderItemChangeNotifier =
      delegateFactory.get(activity)

  public companion object {
    @JvmStatic
    public fun create(delegateFactory: OrderItemChangeNotifier_Factory):
        Provider<OrderItemChangeNotifier.Factory> =
        InstanceFactory.create(OrderItemChangeNotifier_Factory_Impl(delegateFactory))
  }
}
```


FYI, this does compile fine if using the Dagger processor. I also tried moving the Factory to top level class, same error.

Pull request description:
fixes #252

Patch:
diff --git a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/AssistedFactoryGenerator.kt b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/AssistedFactoryGenerator.kt
index 0d4dd3e4c..41d42edf9 100644
--- a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/AssistedFactoryGenerator.kt
+++ b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/dagger/AssistedFactoryGenerator.kt
@@ -219,7 +219,7 @@ internal class AssistedFactoryGenerator : PrivateCodeGenerator() {
           )
         }
         .addFunction(
-          FunSpec.builder("create")
+          FunSpec.builder(function.name.asString())
             .addModifiers(OVERRIDE)
             .returns(returnType.asClassName().parameterized())
             .apply {


Test patch:
diff --git a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/AssistedFactoryGeneratorTest.kt b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/AssistedFactoryGeneratorTest.kt
index 36fb35fd9..e8399e1ed 100644
--- a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/AssistedFactoryGeneratorTest.kt
+++ b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/AssistedFactoryGeneratorTest.kt
@@ -178,6 +178,48 @@ public final class AssistedServiceFactory_Impl implements AssistedServiceFactory
     }
   }
 
+  @Test fun `the implementation function name matches the factory name`() {
+    compile(
+      """
+      package com.squareup.test
+      
+      import dagger.assisted.Assisted
+      import dagger.assisted.AssistedFactory
+      import dagger.assisted.AssistedInject
+      
+      data class AssistedService @AssistedInject constructor(
+        val int: Int,
+        @Assisted val string: String
+      )
+      
+      interface AssistedServiceFactorySuper {
+        fun hephaestus(string: String): AssistedService
+      }
+      
+      @AssistedFactory
+      interface AssistedServiceFactory : AssistedServiceFactorySuper
+      """
+    ) {
+      val factoryImplClass = assistedServiceFactory.implClass()
+      val generatedFactoryInstance = assistedService.factoryClass().createInstance(Provider { 5 })
+      val factoryImplInstance = factoryImplClass.createInstance(generatedFactoryInstance)
+
+      val staticMethods = factoryImplClass.declaredMethods.filter { it.isStatic }
+      assertThat(staticMethods).hasSize(1)
+
+      val factoryProvider = staticMethods.single { it.name == "create" }
+        .invoke(null, generatedFactoryInstance) as Provider<*>
+      assertThat(factoryProvider.get()::class.java).isEqualTo(factoryImplClass)
+
+      val assistedServiceInstance = factoryImplClass.declaredMethods
+        .filterNot { it.isStatic }
+        .single { it.name == "hephaestus" }
+        .invoke(factoryImplInstance, "Hello")
+
+      assertThat(assistedServiceInstance).isEqualTo(assistedService.createInstance(5, "Hello"))
+    }
+  }
+
   @Test fun `an abstract class is supported`() {
     compile(
       """