anchor.diff:        outOfDate();
       }
   
  +    // Check if language version specified in the `package_config.json` is
  +    // correct. This is important for path dependencies as these can mutate.
       for (final pkg in cfg.packages) {
         final id = lockFile.packages[pkg.name];
         if (id == null) {
  -        continue; // Ignore entries that aren't in the lockFile
  -      }
  -
  +        assert(
  +          false,
  +          'unnecessary package_config.json entries should be forbidden by '
  +          '_isPackagePathsMappingUpToDateWithLockfile',
  +        );
  +        continue;
  +      }
  +
  +      // If a package is cached, then it's universally immutable and we need
  +      // not check if the language version is correct.
         final source = cache.source(id.source);
         if (source is CachedSource) {
           continue;
         }
   
         try {
  +        // Load `pubspec.yaml` and extract language version to compare with the
  +        // language version from `package_config.json`.
           final languageVersion = extractLanguageVersion(
             cache.load(id).pubspec.sdkConstraints[sdk.identifier],
           );
  
positive.code:     } on FormatException {
        badPackageConfig();
      }
      if (cfg.configVersion != 2 ||
          cfg.generator != 'pub' ||
          cfg.generatorVersion != sdk.version) {
        badPackageConfig();
      }
  
  
negative.code: 
      var touchedLockFile = false;
      if (lockFileModified.isBefore(pubspecModified) || hasPathDependencies) {
        // If `pubspec.lock` is newer than `pubspec.yaml` or we have path
        // dependencies, then we check that `pubspec.lock` is a correct solution
        // for the requirements in `pubspec.yaml`. This aims to:
        //  * Prevent missing packages when `pubspec.lock` is checked into git.
        //  * Mitigate missing transitive dependencies when the `pubspec.yaml` in
        //    a path dependency is changed.
        _assertLockFileUpToDate();
        if (_arePackagesAvailable()) {
          touchedLockFile = true;
  