anchor.diff:      if (node is UnknownType) {
         // Note: we can't pass [node] to [problem] because it's not a [TreeNode].
         problem(null, "Unexpected appearance of the unknown type.");
  +    }
  +    bool neverLegacy = isNullType(node) ||
  +        node is DynamicType ||
  +        node is InvalidType ||
  +        node is VoidType ||
  +        node is NeverType ||
  +        node is BottomType;
  +    bool expectedLegacy =
  +        !currentLibrary.isNonNullableByDefault && !neverLegacy;
  +    if (expectedLegacy && node.nullability != Nullability.legacy) {
  +      problem(
  +          null, "Found a non-legacy type '${node}' in an opted-out library.");
  +    }
  +    Nullability nodeNullability =
  +        node is InvalidType ? Nullability.undetermined : node.nullability;
  +    if (currentLibrary.isNonNullableByDefault &&
  +        nodeNullability == Nullability.legacy) {
  +      problem(null, "Found a legacy type '${node}' in an opted-in library.");
       }
       super.defaultDartType(node);
     }
  
positive.code:       return;
      }
      fileUri = checkLocation(node, node.name, node.fileUri);
      super.visitLibrary(node);
    }
  
    @override
  
negative.code:         SuperPropertyGet,
          SuperPropertySet,
          TreeNode,
          TypeParameter,
          VoidType;
  
  import 'package:kernel/transformations/flags.dart' show TransformerFlag;
  
  