diff options
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/ast/TreeGen.java | 6 | ||||
-rw-r--r-- | sources/scalac/atree/ATreeTyper.java | 44 | ||||
-rw-r--r-- | sources/scalac/checkers/TreeChecker.java | 6 | ||||
-rw-r--r-- | sources/scalac/symtab/Definitions.java | 162 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/CLRClassParser.java | 2 | ||||
-rw-r--r-- | sources/scalac/transformer/AddConstructors.java | 2 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/AlgebraicMatcher.java | 2 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/Autom2Scala.java | 2 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/CodeFactory.java | 2 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/LeftTracerInScala.java | 8 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/PatternMatcher.java | 4 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/RightTracerInScala.java | 10 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/WordAutomInScala.java | 12 | ||||
-rw-r--r-- | sources/scalac/typechecker/ConstantFolder.java | 18 | ||||
-rw-r--r-- | sources/scalac/typechecker/RefCheck.java | 14 |
15 files changed, 164 insertions, 130 deletions
diff --git a/sources/scalac/ast/TreeGen.java b/sources/scalac/ast/TreeGen.java index 9e08df3f56..bf481e1b39 100644 --- a/sources/scalac/ast/TreeGen.java +++ b/sources/scalac/ast/TreeGen.java @@ -737,7 +737,7 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { public Assign Assign(int pos, Tree lhs, Tree rhs) { Assign tree = make.Assign(pos, lhs, rhs); global.nextPhase(); - tree.setType(definitions.UNIT_TYPE()); + tree.setType(definitions.void_TYPE()); global.prevPhase(); return tree; } @@ -895,7 +895,7 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { if (values.length == 0) return mkNewArray(pos, element, 0); Tree[] trees = new Tree[1 + values.length]; Symbol array = newLocal( - owner, pos, FINAL, "array", definitions.ARRAY_TYPE(element)); + owner, pos, FINAL, "array", definitions.array_TYPE(element)); trees[0] = ValDef(array, mkNewArray(pos, element, values.length)); for (int i = 0; i < values.length; i++) trees[1 + i] = mkArraySet(Ident(pos, array), i, values[i]); @@ -1251,7 +1251,7 @@ public class TreeGen implements Kinds, Modifiers, TypeTags { makeVisitorMethod(pos, Names.apply, applyVisitor, pattype, restype, clazz, owner), makeVisitorMethod(pos, Names.isDefinedAt, isDefinedAtVisitor, - pattype, definitions.BOOLEAN_TYPE(), clazz, owner)}; + pattype, definitions.boolean_TYPE(), clazz, owner)}; Tree classDef = ClassDef(clazz, memberTrees); Tree alloc = New(mkApply__(mkPrimaryConstructorLocalRef(pos, clazz))); return mkBlock(classDef, Typed(alloc, parentTypes[1])); // !!! Typed diff --git a/sources/scalac/atree/ATreeTyper.java b/sources/scalac/atree/ATreeTyper.java index 199dfc0a64..4fa19f622f 100644 --- a/sources/scalac/atree/ATreeTyper.java +++ b/sources/scalac/atree/ATreeTyper.java @@ -53,7 +53,7 @@ public class ATreeTyper { public Type type(ACode code) { switch (code) { case Void: - return definitions.UNIT_TYPE(); + return definitions.void_TYPE(); case This(Symbol clasz): return clasz.thisType(); case Constant(AConstant constant): @@ -65,7 +65,7 @@ public class ATreeTyper { case Apply(AFunction function, Type[] targs, _): return apply(type(function), targs).resultType(); case IsAs(_, Type type, boolean cast): - return cast ? type : definitions.BOOLEAN_TYPE(); + return cast ? type : definitions.boolean_TYPE(); case If(_, ACode success, ACode failure): return Type.lub(new Type[]{type(success), type(failure)}); case Switch(_, _, ACode[] bodies): @@ -129,7 +129,7 @@ public class ATreeTyper { case Primitive(APrimitive primitive): return type(primitive); case NewArray(Type element): - return definitions.ARRAY_TYPE(element); + return definitions.array_TYPE(element); default: throw Debug.abort("unknown case", function); } @@ -165,7 +165,7 @@ public class ATreeTyper { case Conversion(ATypeKind src, ATypeKind dst): return getMethodType(type(src), type(dst)); case ArrayLength(ATypeKind kind): - Type type = definitions.ARRAY_TYPE(type(kind)); + Type type = definitions.array_TYPE(type(kind)); return getMethodType(type, type(ATypeKind.I4)); case StringConcat(ATypeKind lf, ATypeKind rg): return getMethodType(type(lf), type(rg), type(ATypeKind.STR)); @@ -187,15 +187,15 @@ public class ATreeTyper { /** Returns the base type of the given constant. */ public Type basetype(AConstant constant) { switch (constant) { - case UNIT : return definitions.UNIT_TYPE(); - case BOOLEAN(_): return definitions.BOOLEAN_TYPE(); - case BYTE(_) : return definitions.BYTE_TYPE(); - case SHORT(_) : return definitions.SHORT_TYPE(); - case CHAR(_) : return definitions.CHAR_TYPE(); - case INT(_) : return definitions.INT_TYPE(); - case LONG(_) : return definitions.LONG_TYPE(); - case FLOAT(_) : return definitions.FLOAT_TYPE(); - case DOUBLE(_) : return definitions.DOUBLE_TYPE(); + case UNIT : return definitions.void_TYPE(); // !!! -> UNIT_TYPE() + case BOOLEAN(_): return definitions.boolean_TYPE(); + case BYTE(_) : return definitions.byte_TYPE(); + case SHORT(_) : return definitions.short_TYPE(); + case CHAR(_) : return definitions.char_TYPE(); + case INT(_) : return definitions.int_TYPE(); + case LONG(_) : return definitions.long_TYPE(); + case FLOAT(_) : return definitions.float_TYPE(); + case DOUBLE(_) : return definitions.double_TYPE(); case STRING(_) : return definitions.STRING_TYPE(); case NULL : return definitions.ALLREF_TYPE(); case ZERO : return definitions.ALL_TYPE(); @@ -209,18 +209,18 @@ public class ATreeTyper { /** Returns the type of the given type kind. */ public Type type(ATypeKind kind) { switch (kind) { - case UNIT: return definitions.UNIT_TYPE(); - case BOOL: return definitions.BOOLEAN_TYPE(); + case UNIT: return definitions.void_TYPE(); // !!! -> UNIT_TYPE() + case BOOL: return definitions.boolean_TYPE(); // !!! case U1 : return ?; - case U2 : return definitions.CHAR_TYPE(); + case U2 : return definitions.char_TYPE(); // !!! case U4 : return ?; // !!! case U8 : return ?; - case I1 : return definitions.BYTE_TYPE(); - case I2 : return definitions.SHORT_TYPE(); - case I4 : return definitions.INT_TYPE(); - case I8 : return definitions.LONG_TYPE(); - case R4 : return definitions.FLOAT_TYPE(); - case R8 : return definitions.DOUBLE_TYPE(); + case I1 : return definitions.byte_TYPE(); + case I2 : return definitions.short_TYPE(); + case I4 : return definitions.int_TYPE(); + case I8 : return definitions.long_TYPE(); + case R4 : return definitions.float_TYPE(); + case R8 : return definitions.double_TYPE(); case REF : return definitions.ANYREF_TYPE(); case STR : return definitions.STRING_TYPE(); case NULL: return definitions.ALLREF_TYPE(); diff --git a/sources/scalac/checkers/TreeChecker.java b/sources/scalac/checkers/TreeChecker.java index 37446bd7ba..3b140293a5 100644 --- a/sources/scalac/checkers/TreeChecker.java +++ b/sources/scalac/checkers/TreeChecker.java @@ -242,13 +242,13 @@ public class TreeChecker { return true; case If(Tree cond, Tree thenp, Tree elsep): - expression(cond, definitions.BOOLEAN_TYPE()); + expression(cond, definitions.boolean_TYPE()); expression(thenp, expected); expression(elsep, expected); return true; case Switch(Tree test, _, Tree[] bodies, Tree otherwise): - expression(test, definitions.INT_TYPE()); + expression(test, definitions.int_TYPE()); for (int i = 0; i < bodies.length; i++) expression(bodies[i], expected); expression(otherwise, expected); @@ -266,7 +266,7 @@ public class TreeChecker { case New(Tree init): switch (init) { case Apply(Select(Create(_, Tree[] targs), _), Tree[] vargs): - return expression(init, definitions.UNIT_TYPE()); + return expression(init, definitions.void_TYPE()); default: throw Debug.abort("illegal case", show(tree)); } diff --git a/sources/scalac/symtab/Definitions.java b/sources/scalac/symtab/Definitions.java index f086914990..fa057c7ee4 100644 --- a/sources/scalac/symtab/Definitions.java +++ b/sources/scalac/symtab/Definitions.java @@ -82,57 +82,39 @@ public class Definitions { /** The scala.Unit class */ public final Symbol UNIT_CLASS; - public final Type UNIT_TYPE() { - return UNIT_TYPE.type().resultType(); - } + public final Type UNIT_TYPE() {return UNIT_CLASS.staticType();} /** The scala.Boolean class */ public final Symbol BOOLEAN_CLASS; - public final Type BOOLEAN_TYPE() { - return BOOLEAN_TYPE.type().resultType(); - } + public final Type BOOLEAN_TYPE() {return BOOLEAN_CLASS.staticType();} /** The scala.Byte class */ public final Symbol BYTE_CLASS; - public final Type BYTE_TYPE() { - return BYTE_TYPE.type().resultType(); - } + public final Type BYTE_TYPE() {return BYTE_CLASS.staticType();} /** The scala.Short class */ public final Symbol SHORT_CLASS; - public final Type SHORT_TYPE() { - return SHORT_TYPE.type().resultType(); - } + public final Type SHORT_TYPE() {return SHORT_CLASS.staticType();} /** The scala.Char class */ public final Symbol CHAR_CLASS; - public final Type CHAR_TYPE() { - return CHAR_TYPE.type().resultType(); - } + public final Type CHAR_TYPE() {return CHAR_CLASS.staticType();} /** The scala.Int class */ public final Symbol INT_CLASS; - public final Type INT_TYPE() { - return INT_TYPE.type().resultType(); - } + public final Type INT_TYPE() {return INT_CLASS.staticType();} /** The scala.Long class */ public final Symbol LONG_CLASS; - public final Type LONG_TYPE() { - return LONG_TYPE.type().resultType(); - } + public final Type LONG_TYPE() {return LONG_CLASS.staticType();} /** The scala.Float class */ public final Symbol FLOAT_CLASS; - public final Type FLOAT_TYPE() { - return FLOAT_TYPE.type().resultType(); - } + public final Type FLOAT_TYPE() {return FLOAT_CLASS.staticType();} /** The scala.Double class */ public final Symbol DOUBLE_CLASS; - public final Type DOUBLE_TYPE() { - return DOUBLE_TYPE.type().resultType(); - } + public final Type DOUBLE_TYPE() {return DOUBLE_CLASS.staticType();} //######################################################################## // Public Fields & Methods - Scala reference classes @@ -217,15 +199,7 @@ public class Definitions { /** The scala.Array class */ public final Symbol ARRAY_CLASS; public final Type ARRAY_TYPE(Type element) { - Type type = ARRAY_TYPE.type().resultType(); - switch (type) { - case TypeRef(Type prefix, Symbol clasz, _): - return Type.typeRef(prefix, clasz, new Type[]{element}); - case UnboxedArrayType(_): - return Type.UnboxedArrayType(element); - default: - throw Debug.abort("illegal case", type); - } + return ARRAY_CLASS.staticType(element); } /** The scala.Type class & its subclasses */ @@ -247,6 +221,67 @@ public class Definitions { public final Symbol MATCHERROR; //######################################################################## + // Public Fields & Methods - Scala primitive types + + /** Returns the primitive type void. */ + public final Type void_TYPE() { + return void_TYPE.type().resultType(); + } + + /** Returns the primitive type boolean. */ + public final Type boolean_TYPE() { + return boolean_TYPE.type().resultType(); + } + + /** Returns the primitive type byte. */ + public final Type byte_TYPE() { + return byte_TYPE.type().resultType(); + } + + /** Returns the primitive type short. */ + public final Type short_TYPE() { + return short_TYPE.type().resultType(); + } + + /** Returns the primitive type char. */ + public final Type char_TYPE() { + return char_TYPE.type().resultType(); + } + + /** Returns the primitive type int. */ + public final Type int_TYPE() { + return int_TYPE.type().resultType(); + } + + /** Returns the primitive type long. */ + public final Type long_TYPE() { + return long_TYPE.type().resultType(); + } + + /** Returns the primitive type float. */ + public final Type float_TYPE() { + return float_TYPE.type().resultType(); + } + + /** Returns the primitive type double. */ + public final Type double_TYPE() { + return double_TYPE.type().resultType(); + } + + /** Returns the primitive array type of given element type. */ + public final Type array_TYPE(Type element) { + Type type = array_TYPE.type().resultType(); + switch (type) { + case TypeRef(Type prefix, Symbol clasz, _): + return Type.typeRef(prefix, clasz, new Type[]{element}); + case UnboxedArrayType(_): + return Type.UnboxedArrayType(element); + default: + throw Debug.abort("illegal case", type); + } + } + + //######################################################################## // Public Fields & Methods - Top and bottom class methods /** Some scala.Any methods */ @@ -415,7 +450,7 @@ public class Definitions { public Symbol ARRAY_GET() { if (ARRAY_GET == null) - ARRAY_GET = loadTerm(ARRAY_CLASS, Names.apply, new Type[]{INT_TYPE()}); + ARRAY_GET = loadTerm(ARRAY_CLASS, Names.apply, new Type[]{int_TYPE()}); return ARRAY_GET; } @@ -569,16 +604,16 @@ public class Definitions { //######################################################################## // Private Fields - Symbol - private final Symbol UNIT_TYPE; - private final Symbol BOOLEAN_TYPE; - private final Symbol BYTE_TYPE; - private final Symbol SHORT_TYPE; - private final Symbol CHAR_TYPE; - private final Symbol INT_TYPE; - private final Symbol LONG_TYPE; - private final Symbol FLOAT_TYPE; - private final Symbol DOUBLE_TYPE; - private final Symbol ARRAY_TYPE; + private final Symbol void_TYPE; + private final Symbol boolean_TYPE; + private final Symbol byte_TYPE; + private final Symbol short_TYPE; + private final Symbol char_TYPE; + private final Symbol int_TYPE; + private final Symbol long_TYPE; + private final Symbol float_TYPE; + private final Symbol double_TYPE; + private final Symbol array_TYPE; //######################################################################## // Public Constructor @@ -651,17 +686,16 @@ public class Definitions { initClass(ALL_CLASS, new Type[]{ANY_TYPE()}); // create type symbols - UNIT_TYPE = newTypeMethod(Names.Unit ,UNIT_CLASS .staticType()); - BOOLEAN_TYPE = newTypeMethod(Names.Boolean,BOOLEAN_CLASS.staticType()); - BYTE_TYPE = newTypeMethod(Names.Byte ,BYTE_CLASS .staticType()); - SHORT_TYPE = newTypeMethod(Names.Short ,SHORT_CLASS .staticType()); - CHAR_TYPE = newTypeMethod(Names.Char ,CHAR_CLASS .staticType()); - INT_TYPE = newTypeMethod(Names.Int ,INT_CLASS .staticType()); - LONG_TYPE = newTypeMethod(Names.Long ,LONG_CLASS .staticType()); - FLOAT_TYPE = newTypeMethod(Names.Float ,FLOAT_CLASS .staticType()); - DOUBLE_TYPE = newTypeMethod(Names.Double ,DOUBLE_CLASS .staticType()); - ARRAY_TYPE = newTypeMethod(Names.Array , - ARRAY_CLASS.staticType(new Type[]{ANYREF_TYPE()})); + void_TYPE = newTypeMethod(Names.Unit ,UNIT_TYPE()); + boolean_TYPE = newTypeMethod(Names.Boolean,BOOLEAN_TYPE()); + byte_TYPE = newTypeMethod(Names.Byte ,BYTE_TYPE()); + short_TYPE = newTypeMethod(Names.Short ,SHORT_TYPE()); + char_TYPE = newTypeMethod(Names.Char ,CHAR_TYPE()); + int_TYPE = newTypeMethod(Names.Int ,INT_TYPE()); + long_TYPE = newTypeMethod(Names.Long ,LONG_TYPE()); + float_TYPE = newTypeMethod(Names.Float ,FLOAT_TYPE()); + double_TYPE = newTypeMethod(Names.Double ,DOUBLE_TYPE()); + array_TYPE = newTypeMethod(Names.Array ,ARRAY_TYPE(ANYREF_TYPE())); // add members to scala.Any ANY_EQ = newMethod(ANY_CLASS,Names.eq , 0); @@ -675,16 +709,16 @@ public class Definitions { ANY_AS = newMethod(ANY_CLASS,Names.asInstanceOf,Modifiers.FINAL); ANY_MATCH = newMethod(ANY_CLASS,Names.match ,Modifiers.FINAL); - initMethod(ANY_EQ , new Type[]{ANY_TYPE()} , BOOLEAN_TYPE()); - initMethod(ANY_EQEQ , new Type[]{ANY_TYPE()} , BOOLEAN_TYPE()); - initMethod(ANY_BANGEQ , new Type[]{ANY_TYPE()} , BOOLEAN_TYPE()); - initMethod(ANY_EQUALS , new Type[]{ANY_TYPE()} , BOOLEAN_TYPE()); - initMethod(ANY_HASHCODE, new Type[]{} , INT_TYPE()); + initMethod(ANY_EQ , new Type[]{ANY_TYPE()} , boolean_TYPE()); + initMethod(ANY_EQEQ , new Type[]{ANY_TYPE()} , boolean_TYPE()); + initMethod(ANY_BANGEQ , new Type[]{ANY_TYPE()} , boolean_TYPE()); + initMethod(ANY_EQUALS , new Type[]{ANY_TYPE()} , boolean_TYPE()); + initMethod(ANY_HASHCODE, new Type[]{} , int_TYPE()); initMethod(ANY_TOSTRING, new Type[]{} , STRING_TYPE()); // initMethod(ANY_PLUS , new Type[]{STRING_TYPE()}, STRING_TYPE()); Symbol[] ANY_IS_TPARAMS = {newTParam(ANY_IS, 0, ANY_TYPE())}; - ANY_IS.setInfo(Type.PolyType(ANY_IS_TPARAMS, BOOLEAN_TYPE())); + ANY_IS.setInfo(Type.PolyType(ANY_IS_TPARAMS, boolean_TYPE())); Symbol[] ANY_AS_TPARAMS = {newTParam(ANY_AS, 0, ANY_TYPE())}; ANY_AS.setInfo(Type.PolyType(ANY_AS_TPARAMS,ANY_AS_TPARAMS[0].type())); diff --git a/sources/scalac/symtab/classfile/CLRClassParser.java b/sources/scalac/symtab/classfile/CLRClassParser.java index d7d5991cd6..1f71f2aeb0 100644 --- a/sources/scalac/symtab/classfile/CLRClassParser.java +++ b/sources/scalac/symtab/classfile/CLRClassParser.java @@ -199,7 +199,7 @@ public class CLRClassParser extends SymbolLoader { for (int i = 0; i < ENUM_CMP_NAMES.length; i++) { scalac.symtab.Type enumCmpType = make.methodType(argTypes, - global.definitions.BOOLEAN_TYPE(), + global.definitions.boolean_TYPE(), scalac.symtab.Type.EMPTY_ARRAY); Symbol enumCmp = clazz.newMethod (Position.NOPOS, mods, ENUM_CMP_NAMES[i]); diff --git a/sources/scalac/transformer/AddConstructors.java b/sources/scalac/transformer/AddConstructors.java index b8e71d0c3f..2f95cbaecc 100644 --- a/sources/scalac/transformer/AddConstructors.java +++ b/sources/scalac/transformer/AddConstructors.java @@ -95,7 +95,7 @@ public class AddConstructors extends GenTransformer { initializer.setInfo( Type.MethodType( constructor.valueParams(), - global.definitions.UNIT_TYPE()) + global.definitions.void_TYPE()) .cloneType(constructor, initializer)); initializer.owner().members().enterOrOverload(initializer); initializers.put(constructor, initializer); diff --git a/sources/scalac/transformer/matching/AlgebraicMatcher.java b/sources/scalac/transformer/matching/AlgebraicMatcher.java index a366eee16e..044767558c 100644 --- a/sources/scalac/transformer/matching/AlgebraicMatcher.java +++ b/sources/scalac/transformer/matching/AlgebraicMatcher.java @@ -158,7 +158,7 @@ public class AlgebraicMatcher extends PatternMatcher { PartialMatcher m = new PartialMatcher( _m.owner, selector, - defs.BOOLEAN_TYPE() ); + defs.boolean_TYPE() ); Tree pats[] = new Tree[ seqPatNodes.size() ]; Tree body[] = new Tree[ seqPatNodes.size() ]; diff --git a/sources/scalac/transformer/matching/Autom2Scala.java b/sources/scalac/transformer/matching/Autom2Scala.java index 8453ed8f3a..22d20af9ee 100644 --- a/sources/scalac/transformer/matching/Autom2Scala.java +++ b/sources/scalac/transformer/matching/Autom2Scala.java @@ -169,7 +169,7 @@ public class Autom2Scala { Tree _cur_match( Tree pat ) { PartialMatcher m = new PartialMatcher( this.funSym, /* owner*/ currentElem(), /* root */ - defs.BOOLEAN_TYPE() /* restype */); + defs.boolean_TYPE() /* restype */); am.construct( m, new CaseDef[] { cf.gen.CaseDef( pat, diff --git a/sources/scalac/transformer/matching/CodeFactory.java b/sources/scalac/transformer/matching/CodeFactory.java index 2e4f520b1a..0f17b5d2b4 100644 --- a/sources/scalac/transformer/matching/CodeFactory.java +++ b/sources/scalac/transformer/matching/CodeFactory.java @@ -46,7 +46,7 @@ class CodeFactory extends PatternTool { /** returns `List[ Tuple2[ scala.Int, <elemType> ] ]' */ Type SeqTraceType( Type elemType ) { - return defs.LIST_TYPE(pairType(defs.INT_TYPE(), elemType)); + return defs.LIST_TYPE(pairType(defs.int_TYPE(), elemType)); } /** returns `Iterator[ elemType ]' */ diff --git a/sources/scalac/transformer/matching/LeftTracerInScala.java b/sources/scalac/transformer/matching/LeftTracerInScala.java index 4fabce0586..6e7c426c39 100644 --- a/sources/scalac/transformer/matching/LeftTracerInScala.java +++ b/sources/scalac/transformer/matching/LeftTracerInScala.java @@ -47,7 +47,7 @@ public class LeftTracerInScala extends TracerInScala { this.stateSym = owner.newVariable( pos, Modifiers.MUTABLE, cf.fresh.newName( "q" )) - .setType( defs.INT_TYPE() ) ; + .setType( defs.int_TYPE() ) ; this.accumType = _accumType( elementType ); this.accumTypeArg = accumType.typeArgs()[0]; @@ -63,7 +63,7 @@ public class LeftTracerInScala extends TracerInScala { this.funSym .setType( new Type.MethodType( new Symbol[] { // dummy symbol MethodType - funSym.newVParam( pos, 0, cf.fresh.newName( "q" ), defs.INT_TYPE()), + funSym.newVParam( pos, 0, cf.fresh.newName( "q" ), defs.int_TYPE()), funSym.newVParam( pos, 0, cf.fresh.newName( "acc" ), accumType ) }, accumType)); // result type = List[T] @@ -76,7 +76,7 @@ public class LeftTracerInScala extends TracerInScala { .setType( elementType ); this.hasnSym = owner.newVariable( pos, 0, HASNEXT ) - .setType( defs.BOOLEAN_TYPE() ); + .setType( defs.boolean_TYPE() ); } @@ -203,7 +203,7 @@ public class LeftTracerInScala extends TracerInScala { PartialMatcher m = new PartialMatcher( owner, currentElem(), - defs.BOOLEAN_TYPE() ); + defs.boolean_TYPE() ); if( CollectVariableTraverser.containsBinding( pat )) { switch( pat ) { diff --git a/sources/scalac/transformer/matching/PatternMatcher.java b/sources/scalac/transformer/matching/PatternMatcher.java index dc85594953..b33036abfc 100644 --- a/sources/scalac/transformer/matching/PatternMatcher.java +++ b/sources/scalac/transformer/matching/PatternMatcher.java @@ -500,7 +500,7 @@ public class PatternMatcher extends PatternTool { } protected boolean isSimpleIntSwitch() { - if (selector.type.widen().isSameAs(defs.INT_TYPE())) { + if (selector.type.widen().isSameAs(defs.int_TYPE())) { PatternNode patNode = root.and; while (patNode != null) { PatternNode node = patNode; @@ -843,7 +843,7 @@ public class PatternMatcher extends PatternTool { bodies, (defaultCase == null) ? gen.mkBooleanLit(selector.pos, false) : toTree(defaultCase.and), - defs.BOOLEAN_TYPE()); + defs.boolean_TYPE()); } protected Tree toTree(PatternNode node, Tree selector) { diff --git a/sources/scalac/transformer/matching/RightTracerInScala.java b/sources/scalac/transformer/matching/RightTracerInScala.java index a86b041bae..b7ac716183 100644 --- a/sources/scalac/transformer/matching/RightTracerInScala.java +++ b/sources/scalac/transformer/matching/RightTracerInScala.java @@ -134,7 +134,7 @@ public class RightTracerInScala extends TracerInScala { this.stateSym = owner.newVariable ( pos, Modifiers.MUTABLE, cf.fresh.newName("q")) - .setType( defs.INT_TYPE() ) ; + .setType( defs.int_TYPE() ) ; this.curSym = owner.newVariable( pos, Modifiers.MUTABLE, @@ -144,12 +144,12 @@ public class RightTracerInScala extends TracerInScala { this.targetSym = owner.newVariable( pos, Modifiers.MUTABLE, cf.fresh.newName("p")) - .setType( defs.INT_TYPE() ) ; + .setType( defs.int_TYPE() ) ; funSym.setType( new Type.MethodType( new Symbol[] { // dummy symbol MethodType funSym.newVParam( pos, 0, cf.fresh.newName("iter"), cf.SeqTraceType( elementType )), - funSym.newVParam( pos, 0, cf.fresh.newName( "q" ), defs.INT_TYPE()) }, - defs.UNIT_TYPE() )); // result + funSym.newVParam( pos, 0, cf.fresh.newName( "q" ), defs.int_TYPE()) }, + defs.void_TYPE() )); // result } @@ -276,7 +276,7 @@ public class RightTracerInScala extends TracerInScala { //System.err.println( "curT"+currentElem().type().widen() ); PartialMatcher m = new PartialMatcher( owner,//funSym,//this.funSym, currentElem(), - defs.BOOLEAN_TYPE() ); + defs.boolean_TYPE() ); final HashMap freshenMap = new HashMap(); // sym2exp -> new sym HashMap helpMap3 = new HashMap(); // new sym -> original sym diff --git a/sources/scalac/transformer/matching/WordAutomInScala.java b/sources/scalac/transformer/matching/WordAutomInScala.java index 8fde263608..51a3e85c3a 100644 --- a/sources/scalac/transformer/matching/WordAutomInScala.java +++ b/sources/scalac/transformer/matching/WordAutomInScala.java @@ -77,23 +77,23 @@ public class WordAutomInScala extends Autom2Scala { this.stateSym = owner.newVariable( pos, Modifiers.MUTABLE, cf.fresh.newName("q")) - .setType( defs.INT_TYPE() ) ; + .setType( defs.int_TYPE() ) ; this.resultSym = owner.newVariable( pos, Modifiers.MUTABLE, cf.fresh.newName("swRes")) - .setType( defs.INT_TYPE() ) ; + .setType( defs.int_TYPE() ) ; this.funSym .setType( new Type.MethodType( new Symbol[] { - funSym.newVParam( pos, 0, cf.fresh.newName("q"), defs.INT_TYPE()) - }, defs.INT_TYPE() )); + funSym.newVParam( pos, 0, cf.fresh.newName("q"), defs.int_TYPE()) + }, defs.int_TYPE() )); this.curSym = owner.newVariable( pos, 0, CURRENT_ELEM ) .setType( elementType ); this.hasnSym = owner.newVariable( pos, 0, HASNEXT ) - .setType( defs.BOOLEAN_TYPE() ); + .setType( defs.boolean_TYPE() ); } @@ -111,7 +111,7 @@ public class WordAutomInScala extends Autom2Scala { Tree _cur_match( Tree pat ) { // TE ST PartialMatcher m = new PartialMatcher( this.owner, /* owner*/ currentElem(), /* root */ - defs.BOOLEAN_TYPE() /* restype */); + defs.boolean_TYPE() /* restype */); am.construct( m, new CaseDef[] { cf.gen.CaseDef( pat, diff --git a/sources/scalac/typechecker/ConstantFolder.java b/sources/scalac/typechecker/ConstantFolder.java index 04d788d7f5..d796279365 100644 --- a/sources/scalac/typechecker/ConstantFolder.java +++ b/sources/scalac/typechecker/ConstantFolder.java @@ -252,11 +252,11 @@ public class ConstantFolder { public AConstant cast(AConstant value, Type type) { switch (value.kind()) { case UNIT: - if (type.isSameAs(definitions.UNIT_CLASS.type())) + if (type.isSameAs(definitions.void_TYPE())) // !!! -> UNIT_TYPE() return value; return null; case BOOL: - if (type.isSameAs(definitions.BOOLEAN_TYPE())) + if (type.isSameAs(definitions.boolean_TYPE())) return value; return null; case U1: @@ -269,19 +269,19 @@ public class ConstantFolder { case I8: case R4: case R8: - if (type.isSameAs(definitions.BYTE_TYPE())) + if (type.isSameAs(definitions.byte_TYPE())) return AConstant.BYTE(value.byteValue()); - if (type.isSameAs(definitions.SHORT_TYPE())) + if (type.isSameAs(definitions.short_TYPE())) return AConstant.SHORT(value.shortValue()); - if (type.isSameAs(definitions.CHAR_TYPE())) + if (type.isSameAs(definitions.char_TYPE())) return AConstant.CHAR(value.charValue()); - if (type.isSameAs(definitions.INT_TYPE())) + if (type.isSameAs(definitions.int_TYPE())) return AConstant.INT(value.intValue()); - if (type.isSameAs(definitions.LONG_TYPE())) + if (type.isSameAs(definitions.long_TYPE())) return AConstant.LONG(value.longValue()); - if (type.isSameAs(definitions.FLOAT_TYPE())) + if (type.isSameAs(definitions.float_TYPE())) return AConstant.FLOAT(value.floatValue()); - if (type.isSameAs(definitions.DOUBLE_TYPE())) + if (type.isSameAs(definitions.double_TYPE())) return AConstant.DOUBLE(value.doubleValue()); return null; case STR: diff --git a/sources/scalac/typechecker/RefCheck.java b/sources/scalac/typechecker/RefCheck.java index b44e52b640..9358f39722 100644 --- a/sources/scalac/typechecker/RefCheck.java +++ b/sources/scalac/typechecker/RefCheck.java @@ -589,7 +589,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { tree.pos, PRIVATE | SYNTHETIC, m_eqname); Symbol m_eqarg = m_eq.newVParam(tree.pos, SYNTHETIC, name, sym.type()); m_eq.setInfo( - Type.MethodType(new Symbol[] {m_eqarg}, defs.UNIT_TYPE())); + Type.MethodType(new Symbol[] {m_eqarg}, defs.void_TYPE())); Tree m_eqdef = gen.DefDef(m_eq, gen.Assign(gen.mkLocalRef(tree.pos, mvar), gen.Ident(tree.pos, m_eqarg))); sym.owner().members().enterOrOverload(m_eq); @@ -693,7 +693,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { Symbol seSym = clazz.newMethod( clazz.pos, FINAL|OVERRIDE, Names.caseElement ); Symbol seParam = - seSym.newVParam( clazz.pos, 0, Names.n, defs.INT_TYPE() ); + seSym.newVParam( clazz.pos, 0, Names.n, defs.int_TYPE() ); seSym.setInfo( Type.MethodType( new Symbol[]{ seParam }, defs.ANY_TYPE() )); clazz.info().members().enter( seSym ); @@ -717,7 +717,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { Symbol seSym = clazz.newMethod( clazz.pos, FINAL|OVERRIDE, Names.caseArity ); seSym.setInfo( - Type.PolyType( Symbol.EMPTY_ARRAY, defs.INT_TYPE() )); + Type.PolyType( Symbol.EMPTY_ARRAY, defs.int_TYPE() )); clazz.info().members().enter( seSym ); Tree[] fields = caseFields( clazz ); return gen.DefDef(seSym, gen.mkIntLit( clazz.pos, fields.length )); @@ -729,7 +729,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { Symbol equalsParam = equalsSym.newVParam( clazz.pos, 0, Names.that, defs.ANY_TYPE()); equalsSym.setInfo( - Type.MethodType(new Symbol[]{equalsParam}, defs.BOOLEAN_TYPE())); + Type.MethodType(new Symbol[]{equalsParam}, defs.boolean_TYPE())); clazz.info().members().enter(equalsSym); Tree[] fields = caseFields(clazz); Type testtp = clazz.type(); @@ -792,7 +792,7 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { private Tree tagMethod(ClassSymbol clazz) { int flags =clazz.isSubClass(defs.SCALAOBJECT_CLASS) ? OVERRIDE : 0; Symbol tagSym = clazz.newMethod(clazz.pos, flags, Names.tag) - .setInfo(Type.MethodType(Symbol.EMPTY_ARRAY, defs.INT_TYPE())); + .setInfo(Type.MethodType(Symbol.EMPTY_ARRAY, defs.int_TYPE())); clazz.info().members().enter(tagSym); return gen.DefDef( tagSym, @@ -809,9 +809,9 @@ public class RefCheck extends Transformer implements Modifiers, Kinds { Tree[] fields = caseFields(clazz); Symbol getClassMethod = getNullaryMemberMethod(clazz.type(), Names.getClass); Symbol addMethod = getUnaryMemberMethod( - defs.INT_TYPE(), Names.ADD, defs.INT_TYPE()); + defs.int_TYPE(), Names.ADD, defs.int_TYPE()); Symbol mulMethod = getUnaryMemberMethod( - defs.INT_TYPE(), Names.MUL, defs.INT_TYPE()); + defs.int_TYPE(), Names.MUL, defs.int_TYPE()); Tree body = gen.Apply( gen.Select( |