diff options
-rw-r--r-- | build-nsc.xml | 39 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/AlgebraicMatchers.scala | 2 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/Autom2.scala | 2 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/CodeFactory.scala | 13 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/PatternMatchers.scala | 11 | ||||
-rw-r--r-- | sources/scala/tools/nsc/matching/SequenceMatchers.scala | 2 |
6 files changed, 51 insertions, 18 deletions
diff --git a/build-nsc.xml b/build-nsc.xml index 9b70a68eeb..3b0d8221ca 100644 --- a/build-nsc.xml +++ b/build-nsc.xml @@ -1,4 +1,4 @@ -<project name="scala.nsc" default="build"> +<project name="scala.nsc" default="build.nsc"> <!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -12,11 +12,15 @@ %%% Preliminaries %%% + + make jar target=LIBRARY + make jar target=TOOLS + You need a working scalac, which is accessible for ant. This means, you should have `fjbg.jar', `scala.jar' and - `tools.jar' on your classpath [@todo maybe write a script ...] + `tools.jar' on your classpath - !!! use the script ant-build-nsc.sh !!! + check the ant-build-nsc script! adjust to your paths if necessary. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --> @@ -139,21 +143,39 @@ <arg value="sources/scala/runtime/ScalaRunTime.scala"/> - </java--> + </java - <nsc srcdir="sources" destdir="${nsc.output.dir}" classpath=".:sources:newsources:../newsources:${tools.util.dir}" + +--> + <echo>Compiling predef and runtime</echo> + <nsc srcdir="sources" destdir="${nsc.output.dir}" + classpath="sources:newsources:${tools.util.dir}" nscArgs="-nopredefs;-check:term;-check:transmatch;-debug"> <include name="scala/Predef.scala"/> <include name="scala/runtime/ScalaRunTime.scala"/> </nsc> + <echo>Compiling rest</echo> + <nsc srcdir="sources" destdir="${nsc.output.dir}" + classpath="sources:newsources:${tools.util.dir}:${nsc.output.dir}" + nscArgs="-check:term;-check:transmatch;-debug"> + + <include name="scala/**.scala"/> + <include name="../newsources/**.scala"/> + + <exclude name="scala/Predef.scala"/> + <exclude name="scala/runtime/ScalaRunTime.scala"/> + + <exclude name="scala/tools/**"/> + <exclude name="scala/io/UTF8String.scala"/> + </nsc> + + <!-- + <echo>Compiling rest</echo> <nsc srcdir="sources" destdir="${nsc.output.dir}" classpath="sources:newsources:${tools.util.dir}"> - <!-- arg value="-verbose"/> - <arg value="-prompt"/> - <arg value="-check:term"/ --> <include name="../sources.nsc/**/*.scala"/> @@ -165,6 +187,7 @@ <exclude name="scala/tools/**"/> <exclude name="scala/io/UTF8String.scala"/> </nsc> +--> </target> <!-- (*3) for Java, and pico, files are only recompiled if the source file is diff --git a/sources/scala/tools/nsc/matching/AlgebraicMatchers.scala b/sources/scala/tools/nsc/matching/AlgebraicMatchers.scala index 1d32485fcc..d1a3808039 100644 --- a/sources/scala/tools/nsc/matching/AlgebraicMatchers.scala +++ b/sources/scala/tools/nsc/matching/AlgebraicMatchers.scala @@ -67,7 +67,7 @@ trait AlgebraicMatchers : TransMatcher { ), If( super.toTree(root.and), Ident(resultVar ), - ThrowMatchError( _m.pos )) + ThrowMatchError( _m.pos, resultVar.tpe )) ); } diff --git a/sources/scala/tools/nsc/matching/Autom2.scala b/sources/scala/tools/nsc/matching/Autom2.scala index 0d67f0c419..a280dabe1f 100644 --- a/sources/scala/tools/nsc/matching/Autom2.scala +++ b/sources/scala/tools/nsc/matching/Autom2.scala @@ -153,7 +153,7 @@ trait Autom2: TransMatcher { /** some error happened which is due to bug in translation/automaton */ final def code_error(): Tree = { - ThrowMatchError( pos /*, funRetType() */); + ThrowMatchError( pos , funRetType() ); } def code_fail(): Tree = { diff --git a/sources/scala/tools/nsc/matching/CodeFactory.scala b/sources/scala/tools/nsc/matching/CodeFactory.scala index 7995465200..a28d76178c 100644 --- a/sources/scala/tools/nsc/matching/CodeFactory.scala +++ b/sources/scala/tools/nsc/matching/CodeFactory.scala @@ -198,9 +198,12 @@ abstract class CodeFactory: TransMatcher { Apply(Select(left, eqsym), List(right)); } - def ThrowMatchError(pos: Int ) = + def ThrowMatchError(pos: Int, tpe: Type ) = Apply( - gen.mkRef(definitions.MatchError_fail), + TypeApply( + gen.mkRef(definitions.MatchError_fail), + List(TypeTree(tpe)) + ), List( Literal(cunit.toString()), Literal(Position.line(pos)) @@ -218,8 +221,10 @@ abstract class CodeFactory: TransMatcher { ) ); */ - def Error(pos: Int) = - ThrowMatchError(pos); + +// def Error(pos: Int) = +// ThrowMatchError(pos); + /* def newPair(left: Tree, right: Tree) = diff --git a/sources/scala/tools/nsc/matching/PatternMatchers.scala b/sources/scala/tools/nsc/matching/PatternMatchers.scala index b45829378e..33e28627d4 100644 --- a/sources/scala/tools/nsc/matching/PatternMatchers.scala +++ b/sources/scala/tools/nsc/matching/PatternMatchers.scala @@ -171,12 +171,16 @@ trait PatternMatchers: (TransMatcher with PatternNodes) with PatternNodeCreator tree match { case Bind(name, Typed(Ident( nme.WILDCARD ), tpe)) => // x@_:Type if (isSubType(header.getTpe(),tpe.tpe)) { + //Console.println("U"); val node = pDefaultPat(tree.pos, tpe.tpe); env.newBoundVar( tree.symbol, tree.tpe, header.selector ); node; } else { + //Console.println("X"); val node = pConstrPat(tree.pos, tpe.tpe); - env.newBoundVar( tree.symbol, tree.tpe, typed(Ident( node.casted ))); + env.newBoundVar( tree.symbol, + tpe.tpe /*scalac: tree.tpe */, + typed(Ident( node.casted ))); node; } @@ -231,6 +235,7 @@ trait PatternMatchers: (TransMatcher with PatternNodes) with PatternNodeCreator pConstrPat(tree.pos, tree.tpe); } case t @ Typed(ident, tpe) => // variable pattern + //Console.println("Z"); val doTest = isSubType(header.getTpe(),tpe.tpe); val node = { if(doTest) @@ -629,7 +634,7 @@ trait PatternMatchers: (TransMatcher with PatternNodes) with PatternNodeCreator //print(); val ncases = numCases(root.and); - val matchError = ThrowMatchError(selector.pos); + val matchError = ThrowMatchError(selector.pos, resultVar.tpe); // without a case, we return a match error if there is no default case if (ncases == 0) return defaultBody(root.and, matchError); @@ -702,7 +707,7 @@ trait PatternMatchers: (TransMatcher with PatternNodes) with PatternNodeCreator ValDef(resultVar, EmptyTree /* DefaultValue */)); val res = If(toTree(root.and), Ident(resultVar), - ThrowMatchError(selector.pos /* , + ThrowMatchError(selector.pos, resultVar.tpe /* , Ident(root.symbol) */)); return Block(ts, res); } diff --git a/sources/scala/tools/nsc/matching/SequenceMatchers.scala b/sources/scala/tools/nsc/matching/SequenceMatchers.scala index dcbd9bc1a5..d2d8aa7414 100644 --- a/sources/scala/tools/nsc/matching/SequenceMatchers.scala +++ b/sources/scala/tools/nsc/matching/SequenceMatchers.scala @@ -116,7 +116,7 @@ trait SequenceMatchers: TransMatcher { this._m = _m; //assert body.length == pat.length; if( defaultCase == null ) - defaultCase = ThrowMatchError( _m.pos ); + defaultCase = ThrowMatchError( _m.pos, resultType ); val seqType = pat( 0 ).tpe; val elementType1 = getElemType_Sequence( seqType ); |