 Chromium Code Reviews
 Chromium Code Reviews Issue 2941983002:
  [kernel] Fix loss of supertype arguments.  (Closed)
    
  
    Issue 2941983002:
  [kernel] Fix loss of supertype arguments.  (Closed) 
  | Index: runtime/vm/kernel_binary_flowgraph.cc | 
| diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc | 
| index 33c85883c08dca768e4f896411db799a63c561f3..c75d72225583f654ef29975de610735434848cd0 100644 | 
| --- a/runtime/vm/kernel_binary_flowgraph.cc | 
| +++ b/runtime/vm/kernel_binary_flowgraph.cc | 
| @@ -1695,9 +1695,6 @@ const TypeArguments& StreamingDartTypeTranslator::BuildTypeArguments( | 
| type_arguments = TypeArguments::New(length); | 
| for (intptr_t i = 0; i < length; ++i) { | 
| BuildTypeInternal(); // read ith type. | 
| - if (!result_.IsDynamicType()) { | 
| - only_dynamic = false; | 
| - } | 
| if (result_.IsMalformed()) { | 
| type_arguments = TypeArguments::null(); | 
| // skip rest of arguments. | 
| 
Kevin Millikin (Google)
2017/06/21 06:43:42
'skip rest of' ==> 'Skip the rest of the'.
 | 
| @@ -1721,7 +1718,14 @@ StreamingDartTypeTranslator::BuildInstantiatedTypeArguments( | 
| const dart::Class& receiver_class, | 
| intptr_t length) { | 
| const TypeArguments& type_arguments = BuildTypeArguments(length); | 
| - if (type_arguments.IsNull()) return type_arguments; | 
| + | 
| + // If type_arguments is null all arguments are dynamic. | 
| + // If, however, this class doesn't specify all the type arguments directly we | 
| + // still need to finalize the type below in order to get any non-dynamic types | 
| + // from any super. See http://www.dartbug.com/29537. | 
| + if (type_arguments.IsNull() && receiver_class.NumTypeArguments() == length) { | 
| + return type_arguments; | 
| + } | 
| // We make a temporary [Type] object and use `ClassFinalizer::FinalizeType` to | 
| // finalize the argument types. | 
| @@ -5320,7 +5324,6 @@ Fragment StreamingFlowGraphBuilder::BuildConstructorInvocation( | 
| } | 
| if (klass.NumTypeArguments() > 0) { | 
| - const TypeArguments& type_arguments = PeekArgumentsInstantiatedType(klass); | 
| if (!klass.IsGeneric()) { | 
| Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw()); | 
| @@ -5335,6 +5338,8 @@ Fragment StreamingFlowGraphBuilder::BuildConstructorInvocation( | 
| canonicalized_type_arguments.Canonicalize(); | 
| instructions += Constant(canonicalized_type_arguments); | 
| } else { | 
| + const TypeArguments& type_arguments = | 
| + PeekArgumentsInstantiatedType(klass); | 
| instructions += TranslateInstantiatedTypeArguments(type_arguments); | 
| } |