anchor.diff:      }
     }
   
  -  void _assertEqualLineInfo(LineInfo incrLineInfo, LineInfo fullLineInfo) {
  +  void _assertCacheResults({bool expectCachePostConstantsValid: true}) {
  +    _assertCacheSourceResult(TOKEN_STREAM);
  +    _assertCacheSourceResult(SCAN_ERRORS);
  +    _assertCacheSourceResult(PARSED_UNIT);
  +    _assertCacheSourceResult(PARSE_ERRORS);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT1);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT2);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT3);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT4);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT5);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT6);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT7);
  +    _assertCacheSourceResult(LIBRARY_ELEMENT8);
  +    if (expectCachePostConstantsValid) {
  +      _assertCacheSourceResult(LIBRARY_ELEMENT);
  +    }
  +    _assertCacheUnitResult(RESOLVED_UNIT1);
  +    _assertCacheUnitResult(RESOLVED_UNIT2);
  +    _assertCacheUnitResult(RESOLVED_UNIT3);
  +    _assertCacheUnitResult(RESOLVED_UNIT4);
  +    _assertCacheUnitResult(RESOLVED_UNIT5);
  +    _assertCacheUnitResult(RESOLVED_UNIT6);
  +    _assertCacheUnitResult(RESOLVED_UNIT7);
  +    _assertCacheUnitResult(RESOLVED_UNIT8);
  +    _assertCacheUnitResult(RESOLVED_UNIT9);
  +    _assertCacheUnitResult(RESOLVED_UNIT10);
  +    if (expectCachePostConstantsValid) {
  +      _assertCacheUnitResult(RESOLVED_UNIT11);
  +      _assertCacheUnitResult(RESOLVED_UNIT);
  +    }
  +  }
  +
  +  /**
  +   * Assert that the [result] of [source] is not INVALID.
  +   */
  +  void _assertCacheSourceResult(ResultDescriptor result) {
  +    AnalysisCache cache = analysisContext2.analysisCache;
  +    CacheState state = cache.getState(source, result);
  +    expect(state, isNot(CacheState.INVALID), reason: result.toString());
  +  }
  +
  +  /**
  +   * Assert that the [result] of the defining unit [source] is not INVALID.
  +   */
  +  void _assertCacheUnitResult(ResultDescriptor result) {
  +    AnalysisCache cache = analysisContext2.analysisCache;
  +    LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
  +    CacheState state = cache.getState(target, result);
  +    expect(state, isNot(CacheState.INVALID), reason: result.toString());
  +  }
  +
  +  void _assertEqualLineInfo(LineInfo incLineInfo, LineInfo fullLineInfo) {
       for (int offset = 0; offset < 1000; offset++) {
  -      LineInfo_Location incrLocation = incrLineInfo.getLocation(offset);
  +      LineInfo_Location incLocation = incLineInfo.getLocation(offset);
         LineInfo_Location fullLocation = fullLineInfo.getLocation(offset);
  -      if (incrLocation.lineNumber != fullLocation.lineNumber ||
  -          incrLocation.columnNumber != fullLocation.columnNumber) {
  +      if (incLocation.lineNumber != fullLocation.lineNumber ||
  +          incLocation.columnNumber != fullLocation.columnNumber) {
           fail('At offset $offset ' +
  -            '(${incrLocation.lineNumber}, ${incrLocation.columnNumber})' +
  +            '(${incLocation.lineNumber}, ${incLocation.columnNumber})' +
               ' != ' +
               '(${fullLocation.lineNumber}, ${fullLocation.columnNumber})');
         }
  
positive.code:     _checkCacheEntries(analysisContext2.analysisCache);
    }
  
    static void _assertEqualToken(Token incrToken, Token fullToken) {
  //    print('[${incrToken.offset}] |$incrToken| vs. [${fullToken.offset}] |$fullToken|');
      expect(incrToken.type, fullToken.type);
      expect(incrToken.offset, fullToken.offset);
      expect(incrToken.length, fullToken.length);
      expect(incrToken.lexeme, fullToken.lexeme);
    }
  
    static void _assertEqualTokens(
        CompilationUnit incrUnit, CompilationUnit fullUnit) {
      Token incrToken = incrUnit.beginToken;
      Token fullToken = fullUnit.beginToken;
      while (incrToken.type != TokenType.EOF && fullToken.type != TokenType.EOF) {
        _assertEqualToken(incrToken, fullToken);
        // comments
        {
          Token incrComment = incrToken.precedingComments;
          Token fullComment = fullToken.precedingComments;
          while (true) {
            if (fullComment == null) {
              expect(incrComment, isNull);
              break;
            }
            expect(incrComment, isNotNull);
            _assertEqualToken(incrComment, fullComment);
            incrComment = incrComment.next;
            fullComment = fullComment.next;
          }
        }
        // next tokens
        incrToken = incrToken.next;
        fullToken = fullToken.next;
      }
    }
  
negative.code:       expect(newUnit.element, isNot(same(oldUnitElement)));
        return;
      }
      // The cache must still have enough results to make the incremental
      // resolution useful.
      _assertCacheResults(
          expectCachePostConstantsValid: expectCachePostConstantsValid);
      // The existing CompilationUnit[Element] should be updated.
      expect(newUnit, same(oldUnit));
      expect(newUnit.element, same(oldUnitElement));
  