diff --git a/runtime/vm/cha.cc b/runtime/vm/cha.cc index b960a147539..b937357800c 100644 --- a/runtime/vm/cha.cc +++ b/runtime/vm/cha.cc @@ -71,6 +71,8 @@ bool CHA::HasSubclasses(intptr_t cid) { bool CHA::IsImplemented(const Class& cls) { + // Signature classes have different type checking rules. + ASSERT(!cls.IsSignatureClass()); // Can't track dependencies for classes on the VM heap since those are // read-only. // TODO(fschneider): Enable tracking of CHA dependent code for VM heap diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc index ed42cb71810..d7e639670b0 100644 --- a/runtime/vm/flow_graph_type_propagator.cc +++ b/runtime/vm/flow_graph_type_propagator.cc @@ -511,7 +511,10 @@ intptr_t CompileType::ToNullableCid() { if (FLAG_use_cha) { const Class& type_class = Class::Handle(type_->type_class()); CHA* cha = Isolate::Current()->cha(); - if (!cha->IsImplemented(type_class) && + // Don't infer a cid from an abstract type for signature classes since + // there can be multiple compatible classes with different cids. + if (!type_class.IsSignatureClass() && + !cha->IsImplemented(type_class) && !cha->HasSubclasses(type_class.id())) { cid_ = type_class.id(); } else {