Repository: square/anvil (kotlin)
Issue: Factory generation: nested class with lowercase name
Anvil: 2.0,2

Reproducer:
```
class MyClass @Inject constructor(a: asg) {
  class asg @Inject constructor()
}
```

Exception:
```
e: java.lang.IllegalArgumentException: couldn't make a guess for com.example.myapplication.MyClass.asg
        at com.squareup.kotlinpoet.ClassName$Companion.bestGuess(TypeName.kt:465)
        at com.squareup.anvil.compiler.codegen.KotlinPoetKt.requireTypeName(KotlinPoet.kt:65)
        at com.squareup.anvil.compiler.codegen.KotlinPoetKt.mapToParameter(KotlinPoet.kt:110)
        at com.squareup.anvil.compiler.codegen.dagger.InjectConstructorFactoryGenerator.generateFactoryClass(InjectConstructorFactoryGenerator.kt:63)
```
Pull request description: Support inner classes starting with a lowercase character when generating factories for inject constructors.

Fixes #96

Patch:
diff --git a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/KotlinPoet.kt b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/KotlinPoet.kt
index c9a488cf5..084316991 100644
--- a/compiler/src/main/java/com/squareup/anvil/compiler/codegen/KotlinPoet.kt
+++ b/compiler/src/main/java/com/squareup/anvil/compiler/codegen/KotlinPoet.kt
@@ -62,7 +62,7 @@ internal fun KtCallableDeclaration.requireTypeName(
       ?: typeReference.fqNameOrNull(module)
       ?: return typeVariableName()
 
-  return ClassName.bestGuess(fqNameForGuess.asString())
+  return fqNameForGuess.asTypeName()
       .let { if (typeReference.isNullable()) it.copy(nullable = true) else it }
 }
 


Test patch:
diff --git a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt
index 8d249462f..c0b2affbf 100644
--- a/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt
+++ b/compiler/src/test/java/com/squareup/anvil/compiler/dagger/InjectConstructorFactoryGeneratorTest.kt
@@ -676,6 +676,111 @@ public final class InjectClass_Factory implements Factory<InjectClass> {
     }
   }
 
+  @Test
+  fun `a factory class is generated for an inner class starting with a lowercase character`() {
+    /*
+package com.squareup.test;
+
+import dagger.internal.Factory;
+import javax.annotation.Generated;
+
+@Generated(
+    value = "dagger.internal.codegen.ComponentProcessor",
+    comments = "https://dagger.dev"
+)
+@SuppressWarnings({
+    "unchecked",
+    "rawtypes"
+})
+public final class MyClass_innerClass_Factory implements Factory<MyClass.innerClass> {
+  @Override
+  public MyClass.innerClass get() {
+    return newInstance();
+  }
+
+  public static MyClass_innerClass_Factory create() {
+    return InstanceHolder.INSTANCE;
+  }
+
+  public static MyClass.innerClass newInstance() {
+    return new MyClass.innerClass();
+  }
+
+  private static final class InstanceHolder {
+    private static final MyClass_innerClass_Factory INSTANCE = new MyClass_innerClass_Factory();
+  }
+}
+     */
+
+    /*
+package com.squareup.test;
+
+import dagger.internal.Factory;
+import javax.annotation.Generated;
+import javax.inject.Provider;
+
+@Generated(
+    value = "dagger.internal.codegen.ComponentProcessor",
+    comments = "https://dagger.dev"
+)
+@SuppressWarnings({
+    "unchecked",
+    "rawtypes"
+})
+public final class MyClass_Factory implements Factory<MyClass> {
+  private final Provider<MyClass.innerClass> argProvider;
+
+  public MyClass_Factory(Provider<MyClass.innerClass> argProvider) {
+    this.argProvider = argProvider;
+  }
+
+  @Override
+  public MyClass get() {
+    return newInstance(argProvider.get());
+  }
+
+  public static MyClass_Factory create(Provider<MyClass.innerClass> argProvider) {
+    return new MyClass_Factory(argProvider);
+  }
+
+  public static MyClass newInstance(MyClass.innerClass arg) {
+    return new MyClass(arg);
+  }
+}
+     */
+
+    compile(
+        """
+        package com.squareup.test
+        
+        import javax.inject.Inject
+        
+        class MyClass @Inject constructor(arg: innerClass) {
+          class innerClass @Inject constructor()
+        }
+        """
+    ) {
+      val factoryClass =
+        classLoader.loadClass("com.squareup.test.MyClass\$innerClass").factoryClass()
+
+      val constructor = factoryClass.declaredConstructors.single()
+      assertThat(constructor.parameterTypes.toList()).isEmpty()
+
+      val staticMethods = factoryClass.declaredMethods.filter { it.isStatic }
+
+      val factoryInstance = staticMethods.single { it.name == "create" }.invoke(null)
+      assertThat(factoryInstance::class.java).isEqualTo(factoryClass)
+
+      val newInstance = staticMethods.single { it.name == "newInstance" }.invoke(null)
+      val getInstance = (factoryInstance as Factory<*>).get()
+
+      assertThat(newInstance).isNotNull()
+      assertThat(getInstance).isNotNull()
+
+      assertThat(newInstance).isNotSameInstanceAs(getInstance)
+    }
+  }
+
   @Test fun `inner classes are imported correctly`() {
     /*
 package com.squareup.test;