Lookup the rewritten type when rewriting kotlin metadata

Bug: 180707970
Change-Id: Icaaabc4b1afa9eb8a1782e9b198cd0c6294eb32d
diff --git a/src/main/java/com/android/tools/r8/kotlin/KotlinTypeReference.java b/src/main/java/com/android/tools/r8/kotlin/KotlinTypeReference.java
index 088e7ec..bcbf589 100644
--- a/src/main/java/com/android/tools/r8/kotlin/KotlinTypeReference.java
+++ b/src/main/java/com/android/tools/r8/kotlin/KotlinTypeReference.java
@@ -65,11 +65,12 @@
     if (!known.isClassType()) {
       return known.descriptor.toString();
     }
+    DexType rewrittenType = appView.graphLens().lookupClassType(known);
     if (appView.appInfo().hasLiveness()
-        && !appView.withLiveness().appInfo().isNonProgramTypeOrLiveProgramType(known)) {
+        && !appView.withLiveness().appInfo().isNonProgramTypeOrLiveProgramType(rewrittenType)) {
       return defaultValue;
     }
-    DexString descriptor = namingLens.lookupDescriptor(known);
+    DexString descriptor = namingLens.lookupDescriptor(rewrittenType);
     if (descriptor != null) {
       return descriptor.toString();
     }
@@ -102,7 +103,7 @@
   public void trace(DexDefinitionSupplier definitionSupplier) {
     if (known != null && known.isClassType()) {
       // Lookup the definition, ignoring the result. This populates the sets in the Enqueuer.
-      definitionSupplier.definitionFor(known);
+      definitionSupplier.contextIndependentDefinitionFor(known);
     }
   }
 }