Avoid constructing types with errors.

BUG=27626735

Rationale:
Do not construct classes with a link error. Without this,
the error type thought it was Object (mirror's method
IsObjectClass() returns true if there is no superclass).

(cherry picked from commit 8b3f9b246d5bdbf67faeb2b872b75b8d72777bc0)
(also contains follow-up commit 31244b4cde9156632a08103a8bf1cbff4cbae3cc)

Change-Id: I4443779dda47c320115975c1c71b22e118bd8252
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 1afa36a..af5ef04 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -2190,6 +2190,7 @@
   if (kIsDebugBuild) {
     ScopedObjectAccess soa(Thread::Current());
     DCHECK(IsValidHandle(type_handle));
+    DCHECK(!type_handle->IsErroneous());
     if (!is_exact) {
       DCHECK(!type_handle->CannotBeAssignedFromOtherTypes())
           << "Callers of ReferenceTypeInfo::Create should ensure is_exact is properly computed";