Show
Ignore:
Timestamp:
01/07/09 18:53:22 (11 months ago)
Author:
EricAllen
Message:

Added a type normalizer to improve presentation of types in error messages.
Got the type checker working over more of our first 20 compiled programs.
Added corresponding tests to CompilerJUTests.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java

    r3272 r3292  
    8686import edu.rice.cs.plt.tuple.Pair; 
    8787import edu.rice.cs.plt.tuple.Triple; 
     88 
     89import static com.sun.fortress.compiler.typechecker.TypeNormalizer.normalize; 
    8890 
    8991/** 
     
    923925        else { 
    924926            String err = "Applicable overloading of function " + that.getFunction() + 
    925                             " could not be found for argument type " + argument_result.type(); // error message needs work 
     927                " could not be found for argument type " + normalize(argument_result.type().unwrap()); // error message needs work 
    926928            result = new TypeCheckerResult(that, TypeError.make(err, that)); 
    927929            result_type = Option.none(); 
     
    23462348//                         } 
    23472349//                         System.err.println("equal? " + bodyType.equals(returnType.unwrap())); 
    2348             result = newChecker.checkSubtype(bodyType, 
    2349                                                          returnType.unwrap(), 
    2350                                                          that, 
    2351                                                          errorMsg("Function body has type ", bodyType, ", but ", 
    2352                                                                   "declared return type is ", returnType.unwrap())); 
     2350            result = newChecker.checkSubtype(normalize(bodyType), 
     2351                                             normalize(returnType.unwrap()), 
     2352                                             that, 
     2353                                             errorMsg("Function body has type ", normalize(bodyType), ", but ", 
     2354                                                      "declared return type is ", normalize(returnType.unwrap()))); 
    23532355        } 
    23542356