Index: /trunk/ProjectFortress/src/com/sun/fortress/interpreter/glue/WellKnownNames.java
===================================================================
--- /trunk/ProjectFortress/src/com/sun/fortress/interpreter/glue/WellKnownNames.java (revision 3242)
+++ /trunk/ProjectFortress/src/com/sun/fortress/interpreter/glue/WellKnownNames.java (revision 3292)
@@ -36,4 +36,6 @@
     }
 
+    private static String _compilerLibrary = "CompilerLibrary";
+    private static String _compilerBuiltin = "CompilerBuiltin";
     private static String _fortressLibrary = "FortressLibrary";
     private static String _fortressBuiltin = "FortressBuiltin";
@@ -76,4 +78,6 @@
     public final static String labelException = "LabelException";
 
+    public static String compilerLibrary() { return _compilerLibrary; }
+    public static String compilerBuiltin() { return _compilerBuiltin; }
     public static String fortressLibrary() { return _fortressLibrary; }
     public static String fortressBuiltin() { return _fortressBuiltin; }
Index: /trunk/ProjectFortress/src/com/sun/fortress/compiler/CompilerJUTest.scala
===================================================================
--- /trunk/ProjectFortress/src/com/sun/fortress/compiler/CompilerJUTest.scala (revision 3277)
+++ /trunk/ProjectFortress/src/com/sun/fortress/compiler/CompilerJUTest.scala (revision 3292)
@@ -1,4 +1,4 @@
 /*******************************************************************************
-    Copyright 2008 Sun Microsystems, Inc.,
+    Copyright 2009 Sun Microsystems, Inc.,
     4150 Network Circle, Santa Clara, California 95054, U.S.A.
     All rights reserved.
@@ -172,4 +172,12 @@
   }
 
+  def testXXXCompiled13() = {
+    val expected =
+      STATIC_TESTS_DIR + "/XXXCompiled13.fss:20:3-35\n" +
+      "    Function body has type FlatString->(), but declared return type is ()" 
+    Shell.assertStaticErrors(compile("XXXCompiled13.fss"), expected)
+  }
+
+
   def testXXXCompiled14() = {
     val expected =
Index: /trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java
===================================================================
--- /trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java (revision 3272)
+++ /trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeChecker.java (revision 3292)
@@ -86,4 +86,6 @@
 import edu.rice.cs.plt.tuple.Pair;
 import edu.rice.cs.plt.tuple.Triple;
+
+import static com.sun.fortress.compiler.typechecker.TypeNormalizer.normalize;
 
 /**
@@ -923,5 +925,5 @@
         else {
             String err = "Applicable overloading of function " + that.getFunction() +
-                            " could not be found for argument type " + argument_result.type(); // error message needs work
+                " could not be found for argument type " + normalize(argument_result.type().unwrap()); // error message needs work
             result = new TypeCheckerResult(that, TypeError.make(err, that));
             result_type = Option.none();
@@ -2346,9 +2348,9 @@
 //                         }
 //                         System.err.println("equal? " + bodyType.equals(returnType.unwrap()));
-            result = newChecker.checkSubtype(bodyType,
-                                                         returnType.unwrap(),
-                                                         that,
-                                                         errorMsg("Function body has type ", bodyType, ", but ",
-                                                                  "declared return type is ", returnType.unwrap()));
+            result = newChecker.checkSubtype(normalize(bodyType),
+                                             normalize(returnType.unwrap()),
+                                             that,
+                                             errorMsg("Function body has type ", normalize(bodyType), ", but ",
+                                                      "declared return type is ", normalize(returnType.unwrap())));
         }
 
Index: /trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeNormalizer.java
===================================================================
--- /trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeNormalizer.java (revision 3292)
+++ /trunk/ProjectFortress/src/com/sun/fortress/compiler/typechecker/TypeNormalizer.java (revision 3292)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+    Copyright 2009 Sun Microsystems, Inc.,
+    4150 Network Circle, Santa Clara, California 95054, U.S.A.
+    All rights reserved.
+
+    U.S. Government Rights - Commercial software.
+    Government users are subject to the Sun Microsystems, Inc. standard
+    license agreement and applicable provisions of the FAR and its supplements.
+
+    Use is subject to license terms.
+
+    This distribution may include materials developed by third parties.
+
+    Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
+    trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
+ ******************************************************************************/
+package com.sun.fortress.compiler.typechecker;
+import com.sun.fortress.nodes.*;
+import java.util.List;
+import edu.rice.cs.plt.tuple.Option;
+
+/**
+ * This class is responsible for simplifying types, to aid
+ * in error reporting, etc. 
+ */
+public class TypeNormalizer extends NodeUpdateVisitor { 
+    public static Type normalize(Type t) { 
+        return (Type)t.accept(new TypeNormalizer());
+    }
+
+    public Node forIntersectionTypeOnly(IntersectionType that, 
+                                        TypeInfo info_result, 
+                                        List<Type> elements_result) 
+    {
+        if (elements_result.size() == 1) { 
+            return elements_result.get(0);
+        } else { 
+            return super.forIntersectionTypeOnly(that, 
+                                                 info_result, 
+                                                 elements_result);
+        }
+    }
+
+    public Node forUnionTypeOnly(UnionType that, 
+                                 TypeInfo info_result, 
+                                 List<Type> elements_result) 
+    {
+        if (elements_result.size() == 1) { 
+            return elements_result.get(0);
+        } else { 
+            return super.forUnionTypeOnly(that, 
+                                          info_result, 
+                                          elements_result);
+        }
+    }
+
+    public Node forTupleTypeOnly(TupleType that, 
+                                 TypeInfo info_result,
+                                 List<Type> elements_result, 
+                                 Option<Type> varargs_result, 
+                                 List<KeywordType> keywords_result) 
+    { 
+        if (varargs_result.isNone() && 
+            keywords_result.size() == 0 &&
+            elements_result.size() == 1)
+            { 
+                return elements_result.get(0);
+            }
+        else { 
+            return super.forTupleTypeOnly(that, info_result, elements_result,
+                                          varargs_result, keywords_result);
+        }
+    }
+}
Index: /trunk/ProjectFortress/build.xml
===================================================================
--- /trunk/ProjectFortress/build.xml (revision 3244)
+++ /trunk/ProjectFortress/build.xml (revision 3292)
@@ -77,7 +77,7 @@
   <!-- Scala jar files -->
   <property name="scala-compiler.jar"
-            value="${basedir}/third_party/scala/scala-compiler-2.7.1.jar"/>
+            value="${basedir}/third_party/scala/scala-compiler-2.7.3.jar"/>
   <property name="scala-library.jar"
-            value="${basedir}/third_party/scala/scala-library-2.7.1.jar"/>
+            value="${basedir}/third_party/scala/scala-library-2.7.3.jar"/>
 
   <!-- ASTGen -->
@@ -488,6 +488,22 @@
   </target>
 
-  <target name="compileAll" depends="compile"
+  <target name="compileAll" depends="clean, compileCommon, makeAST, parser, operatorsGen"
           description="Compile all Fortress code.">
+    <javac
+        srcdir="${src}"
+        destdir="${build}"
+        source="1.5"
+        debug="true"
+        includeantruntime="false"
+        fork="true"
+        memorymaximumsize="${junitMem}">
+      <!-- Uncomment the following line to print unchecked warnings
+           (here and in the 'compileCommon' target. -->
+      <!-- <compilerarg value="-Xlint:unchecked"/> -->
+      <classpath refid="compile.classpath"/>
+      <include name="**/*.java"/>
+      <exclude name="${usefulPackage}/*.java"/>
+      <exclude name="${unicodePackage}/*.java"/>
+    </javac>
     <scalac
         srcdir="${src}"
