Add an Expression type, which is a tuple of a CodeBlock and the type that it represents. This will help implementing BindingExpressions for @Binds methods, in particular for the following case:

@Binds Foo to(FooImpl impl);

where Foo is public but FooImpl is not, nor is it in the same package as the component. If FooImpl is scoped, a rawtypes Provider will be used. Before this change, the BindingExpression for Foo had no way of knowing if the FooImpl it was receiving was in fact a FooImpl or an Object from the perspective of the compiler.

This should also hopefully simplify some of the logic in SimpleMethodBindingExpression and InjectionMethods where casting is needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170374236
diff --git a/java/dagger/internal/codegen/SubcomponentBuilderBindingExpression.java b/java/dagger/internal/codegen/SubcomponentBuilderBindingExpression.java
index 1e87fe7..02b99d5 100644
--- a/java/dagger/internal/codegen/SubcomponentBuilderBindingExpression.java
+++ b/java/dagger/internal/codegen/SubcomponentBuilderBindingExpression.java
@@ -18,19 +18,29 @@
 
 import com.squareup.javapoet.ClassName;
 import com.squareup.javapoet.CodeBlock;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
 
 /** A binding expression for a subcomponent builder that just invokes the constructor. */
 final class SubcomponentBuilderBindingExpression extends SimpleInvocationBindingExpression {
   private final String subcomponentBuilderName;
+  private final ContributionBinding binding;
 
-  SubcomponentBuilderBindingExpression(BindingExpression delegate, String subcomponentBuilderName) {
-    super(delegate);
+  SubcomponentBuilderBindingExpression(
+      BindingExpression delegate,
+      ContributionBinding binding,
+      String subcomponentBuilderName,
+      Types types,
+      Elements elements) {
+    super(delegate, types, elements);
     this.subcomponentBuilderName = subcomponentBuilderName;
+    this.binding = binding;
   }
 
   @Override
-  CodeBlock getInstanceDependencyExpression(
+  Expression getInstanceDependencyExpression(
       DependencyRequest.Kind requestKind, ClassName requestingClass) {
-    return CodeBlock.of("new $LBuilder()", subcomponentBuilderName);
+    return Expression.create(
+        binding.key().type(), CodeBlock.of("new $LBuilder()", subcomponentBuilderName));
   }
 }