anchor.diff:            to: loopVariableElement.type, from: elementType);
       }
     }
  +
  +  static DartType _elementType(Element e) {
  +    if (e is ConstructorElement) {
  +      return e.type;
  +    } else if (e is FieldElement) {
  +      return e.type;
  +    } else if (e is MethodElement) {
  +      return e.type;
  +    } else if (e is ParameterElement) {
  +      return e.type;
  +    } else if (e is PropertyAccessorElement) {
  +      return e.type;
  +    }
  +    throw StateError('${e.runtimeType} is unhandled type');
  +  }
   }
   
   class _TopLevelInitializerValidator extends RecursiveAstVisitor<void> {
  
positive.code:   void visitDefaultFormalParameter(DefaultFormalParameter node) {
      // Check that defaults have the proper subtype.
      var parameter = node.parameter;
      var parameterType = _elementType(parameter.declaredElement);
      var defaultValue = node.defaultValue;
      if (defaultValue != null) {
        checkAssignment(defaultValue, parameterType);
      }
  
  
negative.code:     FunctionType functionType;
      var parent = body.parent;
      if (parent is Declaration) {
        functionType = _elementType(parent.declaredElement!) as FunctionType;
      } else {
        assert(parent is FunctionExpression);
        functionType = (parent as FunctionExpression).staticType as FunctionType;
  