Changeset 3292

Show
Ignore:
Timestamp:
01/07/09 18:53:22 (6 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:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ProjectFortress/build.xml

    r3244 r3292  
    7777  <!-- Scala jar files --> 
    7878  <property name="scala-compiler.jar" 
    79             value="${basedir}/third_party/scala/scala-compiler-2.7.1.jar"/> 
     79            value="${basedir}/third_party/scala/scala-compiler-2.7.3.jar"/> 
    8080  <property name="scala-library.jar" 
    81             value="${basedir}/third_party/scala/scala-library-2.7.1.jar"/> 
     81            value="${basedir}/third_party/scala/scala-library-2.7.3.jar"/> 
    8282 
    8383  <!-- ASTGen --> 
     
    488488  </target> 
    489489 
    490   <target name="compileAll" depends="compile
     490  <target name="compileAll" depends="clean, compileCommon, makeAST, parser, operatorsGen
    491491          description="Compile all Fortress code."> 
     492    <javac 
     493        srcdir="${src}" 
     494        destdir="${build}" 
     495        source="1.5" 
     496        debug="true" 
     497        includeantruntime="false" 
     498        fork="true" 
     499        memorymaximumsize="${junitMem}"> 
     500      <!-- Uncomment the following line to print unchecked warnings 
     501           (here and in the 'compileCommon' target. --> 
     502      <!-- <compilerarg value="-Xlint:unchecked"/> --> 
     503      <classpath refid="compile.classpath"/> 
     504      <include name="**/*.java"/> 
     505      <exclude name="${usefulPackage}/*.java"/> 
     506      <exclude name="${unicodePackage}/*.java"/> 
     507    </javac> 
    492508    <scalac 
    493509        srcdir="${src}" 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/CompilerJUTest.scala

    r3277 r3292  
    11/******************************************************************************* 
    2     Copyright 2008 Sun Microsystems, Inc., 
     2    Copyright 2009 Sun Microsystems, Inc., 
    33    4150 Network Circle, Santa Clara, California 95054, U.S.A. 
    44    All rights reserved. 
     
    172172  } 
    173173 
     174  def testXXXCompiled13() = { 
     175    val expected = 
     176      STATIC_TESTS_DIR + "/XXXCompiled13.fss:20:3-35\n" + 
     177      "    Function body has type FlatString->(), but declared return type is ()"  
     178    Shell.assertStaticErrors(compile("XXXCompiled13.fss"), expected) 
     179  } 
     180 
     181 
    174182  def testXXXCompiled14() = { 
    175183    val expected = 
  • 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 
  • trunk/ProjectFortress/src/com/sun/fortress/interpreter/glue/WellKnownNames.java

    r3242 r3292  
    3636    } 
    3737 
     38    private static String _compilerLibrary = "CompilerLibrary"; 
     39    private static String _compilerBuiltin = "CompilerBuiltin"; 
    3840    private static String _fortressLibrary = "FortressLibrary"; 
    3941    private static String _fortressBuiltin = "FortressBuiltin"; 
     
    7678    public final static String labelException = "LabelException"; 
    7779 
     80    public static String compilerLibrary() { return _compilerLibrary; } 
     81    public static String compilerBuiltin() { return _compilerBuiltin; } 
    7882    public static String fortressLibrary() { return _fortressLibrary; } 
    7983    public static String fortressBuiltin() { return _fortressBuiltin; }