Index: runtime/vm/flow_graph_type_propagator.cc |
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc |
index d3cdc8418fb36da18f6e90f63ddd8fb341df80a6..43a19012068d18d7a30b2b8c76158d9f8c2ebf94 100644 |
--- a/runtime/vm/flow_graph_type_propagator.cc |
+++ b/runtime/vm/flow_graph_type_propagator.cc |
@@ -488,7 +488,7 @@ intptr_t CompileType::ToNullableCid() { |
} else if (type_->IsMalformed()) { |
cid_ = kDynamicCid; |
} else if (type_->IsVoidType()) { |
- cid_ = kNullCid; |
+ cid_ = kDynamicCid; |
} else if (type_->IsFunctionType() || type_->IsDartFunctionType()) { |
cid_ = kClosureCid; |
} else if (type_->HasResolvedTypeClass()) { |
@@ -575,7 +575,7 @@ bool CompileType::CanComputeIsInstanceOf(const AbstractType& type, |
return false; |
} |
- if (type.IsDynamicType() || type.IsObjectType()) { |
+ if (type.IsDynamicType() || type.IsObjectType() || type.IsVoidType()) { |
*is_instance = true; |
return true; |
} |
@@ -587,11 +587,6 @@ bool CompileType::CanComputeIsInstanceOf(const AbstractType& type, |
// Consider the compile type of the value. |
const AbstractType& compile_type = *ToAbstractType(); |
- // The compile-type of a value should never be void. The result of a void |
- // function must always be null, which was checked to be null at the return |
- // statement inside the function. |
- ASSERT(!compile_type.IsVoidType()); |
- |
if (compile_type.IsMalformedOrMalbounded()) { |
return false; |
} |
@@ -606,12 +601,6 @@ bool CompileType::CanComputeIsInstanceOf(const AbstractType& type, |
return true; |
} |
- // A non-null value is not an instance of void. |
- if (type.IsVoidType()) { |
- *is_instance = IsNull(); |
- return HasDecidableNullability(); |
- } |
- |
// If the value can be null then we can't eliminate the |
// check unless null is allowed. |
if (is_nullable_ && !is_nullable) { |
@@ -628,11 +617,6 @@ bool CompileType::IsMoreSpecificThan(const AbstractType& other) { |
return false; |
} |
- if (other.IsVoidType()) { |
- // The only value assignable to void is null. |
- return IsNull(); |
- } |
- |
return ToAbstractType()->IsMoreSpecificThan(other, NULL, NULL, Heap::kOld); |
} |
@@ -807,11 +791,6 @@ CompileType AssertAssignableInstr::ComputeType() const { |
return *value_type; |
} |
- if (dst_type().IsVoidType()) { |
- // The only value assignable to void is null. |
- return CompileType::Null(); |
- } |
- |
return CompileType::Create(value_type->ToCid(), dst_type()); |
} |
@@ -902,13 +881,9 @@ CompileType StaticCallInstr::ComputeType() const { |
} |
if (Isolate::Current()->type_checks()) { |
- // Void functions are known to return null, which is checked at the return |
- // from the function. |
const AbstractType& result_type = |
AbstractType::ZoneHandle(function().result_type()); |
- return CompileType::FromAbstractType( |
- result_type.IsVoidType() ? AbstractType::ZoneHandle(Type::NullType()) |
- : result_type); |
+ return CompileType::FromAbstractType(result_type); |
} |
return CompileType::Dynamic(); |