nice-commit Mailing List for The Nice Programming Language (Page 17)
Brought to you by:
bonniot
You can subscribe to this list here.
2003 |
Jan
|
Feb
(60) |
Mar
(125) |
Apr
(183) |
May
(140) |
Jun
(227) |
Jul
(141) |
Aug
(181) |
Sep
(75) |
Oct
(89) |
Nov
(187) |
Dec
(162) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(69) |
Feb
(197) |
Mar
(98) |
Apr
(26) |
May
(10) |
Jun
(85) |
Jul
(88) |
Aug
(79) |
Sep
(80) |
Oct
(81) |
Nov
(53) |
Dec
(109) |
2005 |
Jan
(68) |
Feb
(77) |
Mar
(232) |
Apr
(79) |
May
(37) |
Jun
(37) |
Jul
(3) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(10) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(9) |
2007 |
Jan
(2) |
Feb
(8) |
Mar
(2) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
|
Nov
(17) |
Dec
(6) |
2008 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Daniel B. <bo...@us...> - 2005-03-07 17:11:25
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18310 Modified Files: NEWS Log Message: Allow value returns in void methods. We don't need to distinguish between real and "fake" (sugared) returns. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** NEWS 7 Mar 2005 10:32:10 -0000 1.66 --- NEWS 7 Mar 2005 17:10:54 -0000 1.67 *************** *** 16,19 **** --- 16,41 ---- becouse Nice will detect that "instance" is of a "sure type" after the "instance = new Foo();" assignment. + * Allow value returns in void methods. It's useful when exiting from + the method in a branch after doing a single operation. For instance, + instead of: + + void add(int x) + { + if (x == 0) + { + buffer.append("ZERO\n"); + return; + } + ... + } + + one can now more simply write: + + void add(int x) + { + if (x == 0) + return buffer.append("ZERO\n"); + ... + } -- |
From: Daniel B. <bo...@us...> - 2005-03-07 14:21:35
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12317/stdlib/nice/lang Modified Files: array.nice Log Message: Added fill method for bidimensional arrays. Index: array.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/array.nice,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** array.nice 29 Jul 2004 12:36:12 -0000 1.37 --- array.nice 7 Mar 2005 14:21:21 -0000 1.38 *************** *** 137,141 **** It is important that no reference to the array is kept, because that would make it possible to store null values in it. ! There is no danger as long as the array is created inside the call, like in the above example. */ --- 137,141 ---- It is important that no reference to the array is kept, because that would make it possible to store null values in it. ! There is no danger as long as the array is created inside the call, like in the above example. */ *************** *** 146,150 **** for (int i = 0; i < array.length; i++) array[i] = value(i); ! return cast(array); } --- 146,179 ---- for (int i = 0; i < array.length; i++) array[i] = value(i); ! return cast(array); // all values have been initialized, the cast is safe ! } ! ! /** ! Fills a newly created bidimensional array with non-null values. ! ! A typical usage is to allocate a new array and set its values at the same time: ! <code> ! String[][] coords = new String[10][10].fill((int i, int j) => ""i","j); ! </code> ! ! The equivalent code in Java would be: ! <code> ! String[][] coords = new String[10][10]; ! for (int i = 0; i < 10; i++) ! for (int j = 0; j < 10; i++) ! coords[i] = i + "," + j; ! </code> ! ! It is important that no reference to the array is kept, ! because that would make it possible to store null values in it. ! There is no danger as long as the array is created inside the call, ! like in the above example. ! */ ! <T, U | U <: T> U[][] fill(T[][] array, (int,int)->U value) ! { ! for (int i = 0; i < array.length; i++) ! for (int j = 0; j < array[i].length; j++) ! array[i][j] = value(i,j); ! return cast(array); // all values have been initialized, the cast is safe } |
From: Artem Gr K. <ar...@us...> - 2005-03-07 13:40:04
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1309 Modified Files: build.xml Log Message: Bootstrap nice.tools.visibility Index: build.xml =================================================================== RCS file: /cvsroot/nice/Nice/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 7 Mar 2005 09:55:07 -0000 1.5 --- build.xml 7 Mar 2005 13:39:53 -0000 1.6 *************** *** 110,113 **** --- 110,114 ---- <mac-javac-single includes="nice/tools/util/System.java" /> <mac-nicec-old package="nice.tools.repository" args="-R" /> + <mac-nicec-old package="nice.tools.visibility" args="-r" /> <mac-javac-multi> <include> |
From: Daniel B. <bo...@us...> - 2005-03-07 12:15:39
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12418 Modified Files: Makefile Log Message: Bootstrap nice.tools.visibility Index: Makefile =================================================================== RCS file: /cvsroot/nice/Nice/Makefile,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** Makefile 4 Mar 2005 21:36:08 -0000 1.161 --- Makefile 7 Mar 2005 12:15:25 -0000 1.162 *************** *** 163,166 **** --- 163,167 ---- ${JAVAC} src/nice/tools/util/System.java ${NICEC} -R nice.tools.repository + ${NICEC} -r nice.tools.visibility ${JAVAC} \ src/bossa/syntax/dispatch.java \ |
From: Daniel B. <bo...@us...> - 2005-03-07 11:35:12
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2778/stdlib/nice/lang Modified Files: prelude.nice Log Message: Typo. Index: prelude.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/prelude.nice,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** prelude.nice 7 Mar 2005 09:49:21 -0000 1.41 --- prelude.nice 7 Mar 2005 11:34:55 -0000 1.42 *************** *** 39,43 **** /** ! * Assert that a <code>value</code> it not <code>null</code>. * Throws java.lang.AssertionError if assertions are enabled and the argument is <code>null</code>. */ --- 39,43 ---- /** ! * Assert that a <code>value</code> is not <code>null</code>. * Throws java.lang.AssertionError if assertions are enabled and the argument is <code>null</code>. */ |
From: Artem Gr K. <ar...@us...> - 2005-03-07 10:32:25
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19668 Modified Files: NEWS Log Message: maybeNull, and RFE 681385 Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** NEWS 7 Mar 2005 08:27:52 -0000 1.65 --- NEWS 7 Mar 2005 10:32:10 -0000 1.66 *************** *** 1,5 **** nice (0.9.11) ! * -- --- 1,19 ---- nice (0.9.11) ! * maybeNull, a counterpart to the notNull, might be used from now on ! to test variables returned from Java libraries without retyping: ! let prng = SecureRandom.getInstance("ARCFOUR"); ! // Test if a bad implementation has returned null instead of exception. ! if(maybeNull(prng) == null) workaround(); ! * Nullness analysis of assignments (RFE 681385) is partially implemented. ! It is now possible to write: ! class Foo {} ! var ?Foo FOO_INSTANCE = null; ! Foo getFooInstance(){ ! var instance = FOO_INSTANCE; if( null != instance ) return instance; ! instance = new Foo(); FOO_INSTANCE = instance; return instance; ! } ! becouse Nice will detect that "instance" is of a "sure type" ! after the "instance = new Foo();" assignment. -- |
From: Artem Gr K. <ar...@us...> - 2005-03-07 09:55:24
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10629 Modified Files: build.xml Log Message: Changed the version string to "0.9.11 prerelease". Index: build.xml =================================================================== RCS file: /cvsroot/nice/Nice/build.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build.xml 7 Mar 2005 08:13:34 -0000 1.4 --- build.xml 7 Mar 2005 09:55:07 -0000 1.5 *************** *** 177,181 **** <target name="setDate"> <!-- TODO: Extract the current Nice version from the head of the NEWS file. --> ! <property name="version" value="0.9.10" /> <property name="to" value="src/nice/tools/compiler/dateBuild.nice" /> <tstamp> --- 177,181 ---- <target name="setDate"> <!-- TODO: Extract the current Nice version from the head of the NEWS file. --> ! <property name="version" value="0.9.11 prerelease" /> <property name="to" value="src/nice/tools/compiler/dateBuild.nice" /> <tstamp> |
From: Artem Gr K. <ar...@us...> - 2005-03-07 09:49:52
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9419/stdlib/nice/lang Modified Files: prelude.nice Log Message: maybeNull Index: prelude.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/prelude.nice,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** prelude.nice 5 Nov 2004 15:22:05 -0000 1.40 --- prelude.nice 7 Mar 2005 09:49:21 -0000 1.41 *************** *** 38,48 **** final class Null<+T> extends Maybe<T> = native; ! /** ! Throws java.lang.NullPointerException if the argument is <code>null</code>. ! ! This call presently does no check, assuming that a dereferencing ! is coming next and will detect nullness. ! This should probably be fixed so that the semantics is well defined. ! */ <T> !T notNull(?T value) { --- 38,45 ---- final class Null<+T> extends Maybe<T> = native; ! /** ! * Assert that a <code>value</code> it not <code>null</code>. ! * Throws java.lang.AssertionError if assertions are enabled and the argument is <code>null</code>. ! */ <T> !T notNull(?T value) { *************** *** 51,54 **** --- 48,63 ---- } + /** + * Tell the compiler that the <code>value</code> might be <code>null</code>.<br> + * Useful to check if the variable is <code>null</code> + * without issuing a compile-time warning: <code>if( maybeNull( var ) == null )</code>.<br> + * The need for this method might arise in particular when using + * existing Java libraries. Nice often thinks that Java method + * would not return a <code>null</code> value, and it is not always practical + * to write a retyping for the method.<br> + * See also the "Option types" chapter of the Nice manual. + */ + <T> ?T maybeNull(!T value) = value; + /**************************************************************** * Primitive types |
From: Daniel B. <bo...@us...> - 2005-03-07 08:28:03
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23515 Modified Files: NEWS Log Message: Opened 0.9.11 Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** NEWS 25 Feb 2005 16:15:40 -0000 1.64 --- NEWS 7 Mar 2005 08:27:52 -0000 1.65 *************** *** 1,2 **** --- 1,8 ---- + nice (0.9.11) + + * + + -- + nice (0.9.10) |
From: Artem Gr K. <ar...@us...> - 2005-03-07 08:17:04
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20664/src/bossa/syntax Modified Files: typecheck.nice Log Message: Nullness analisys on assignments is partially implemented (RFE 681385). Index: typecheck.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/typecheck.nice,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** typecheck.nice 22 Feb 2005 10:26:42 -0000 1.125 --- typecheck.nice 7 Mar 2005 08:16:53 -0000 1.126 *************** *** 52,55 **** --- 52,70 ---- e.value = e.value.resolveOverloading(to.getType()); checkAssignment(to.getType(), e.value); + + // RFE 681385 + // To debug in jdb use "stop at bossa.syntax.fun:LINE". + if( variable != null ){ + let valueType = e.value.type, toType = to.type, varType = variable.type; + if( valueType != null && toType != null && varType != null ){ + let toNotNull = isNotNull( toType ); + let valueNotNull = isNotNull( valueType ); + if( ! toNotNull && valueNotNull ){ + //bossa.util.User.warning( e, e.toString() ); + mlsub.typing.Monotype type = varType; + mlsub.typing.Monotype sureType = makeSure( type ); + variable.setVarType( now: sureType, otherBranch: type, out: type ); + } } } + } catch(mlsub.typing.TypingEx t){ *************** *** 417,424 **** void enterElse() { ! while (levels.size() > 0 && levels.peek() == ifLevel * 2) { ! levels.pop(); ! (MonoSymbol variable, mlsub.typing.Monotype baseType) = conditionalTypes.pop(); variable.type = baseType; } --- 432,443 ---- void enterElse() { ! // "out" (ifLevel * 2) and "otherBranch" (ifLevel * 2 + 1) records might be mixed in the stack, ! // therefore we scan the tail of the stack while "level >= ifLevel * 2", ignoring "out" records. ! for (int i = levels.size() - 1; i >= 0; i--) { ! int level = levels.get(i); ! if( level < ifLevel * 2 ) break; ! if( level != ifLevel * 2 + 1 ) continue; ! (MonoSymbol variable, mlsub.typing.Monotype baseType) = conditionalTypes.get(i); variable.type = baseType; } *************** *** 426,435 **** void exitIf() ! { ! while (levels.size() > 0 && levels.peek() == ifLevel * 2 + 1) { ! levels.pop(); (MonoSymbol variable, mlsub.typing.Monotype baseType) = conditionalTypes.pop(); ! variable.type = baseType; } ifLevel--; --- 445,457 ---- void exitIf() ! { ! // since "out" and "otherBranch" records might be mixed, ! // we should pop everything which is "level >= ifLevel * 2", ! // but ignore "otherBranch" (ifLevel * 2 + 1) records. ! while (levels.size() > 0 && levels.peek() >= ifLevel * 2) { ! int level = levels.pop(); (MonoSymbol variable, mlsub.typing.Monotype baseType) = conditionalTypes.pop(); ! if( level == ifLevel * 2 ) variable.type = baseType; } ifLevel--; *************** *** 438,442 **** void pushBranchType(MonoSymbol variable, mlsub.typing.Monotype baseType) { ! levels.push(2 * ifLevel); conditionalTypes.push((variable, baseType)); } --- 460,464 ---- void pushBranchType(MonoSymbol variable, mlsub.typing.Monotype baseType) { ! levels.push(2 * ifLevel + 1); conditionalTypes.push((variable, baseType)); } *************** *** 444,448 **** void pushOuterType(MonoSymbol variable, mlsub.typing.Monotype baseType) { ! levels.push(2 * ifLevel + 1); conditionalTypes.push((variable, baseType)); } --- 466,470 ---- void pushOuterType(MonoSymbol variable, mlsub.typing.Monotype baseType) { ! levels.push(2 * ifLevel); conditionalTypes.push((variable, baseType)); } *************** *** 451,455 **** { for (int i = 0; i < levels.size(); i++) ! if (levels.get(i) % 2 == 1) { (MonoSymbol v, mlsub.typing.Monotype t) = conditionalTypes.get(i); --- 473,477 ---- { for (int i = 0; i < levels.size(); i++) ! if (levels.get(i) % 2 == 0) { (MonoSymbol v, mlsub.typing.Monotype t) = conditionalTypes.get(i); *************** *** 940,946 **** typecheck(TryStmt t) { ! typecheck(t.body); ! t.catches.foreach(ACatch c => typecheck(c.body)); ! typecheck(t.finallyBody); } --- 962,975 ---- typecheck(TryStmt t) { ! enterBlock(); ! try{ ! typecheck( t.body ); ! enterElse(); ! for( ACatch c : t.catches ){ ! typecheck( c.body ); ! enterElse(); ! } ! typecheck( t.finallyBody ); ! }finally{ exitIf(); } } *************** *** 1066,1069 **** --- 1095,1108 ---- } + boolean isNotNull( mlsub.typing.Polytype type ) + { + try{ + checkNotNull( type ); // Will throw a TypingEx if the 'value' is not a sureTC. + return true; + }catch( mlsub.typing.TypingEx skip ){ + return false; + } + } + // Local Variables: // nice-xprogram: "../bin/nicec -d ../classes" |
From: Artem Gr K. <ar...@us...> - 2005-03-07 08:17:03
|
Update of /cvsroot/nice/Nice/testsuite/compiler/null In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20664/testsuite/compiler/null Modified Files: inference.testsuite Log Message: Nullness analisys on assignments is partially implemented (RFE 681385). Index: inference.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/null/inference.testsuite,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** inference.testsuite 25 Aug 2004 19:57:22 -0000 1.11 --- inference.testsuite 7 Mar 2005 08:16:51 -0000 1.12 *************** *** 312,319 **** x1 = x1 + ""; ! /// FAIL ! ?String x1 = null; ! if ( (x1 = "abc") == null) ! x1 = x1 + ""; /// PASS --- 312,322 ---- x1 = x1 + ""; ! // This should _probably_ fail ! // either becouse it can never be true ! // or becouse x1 is checked to be null. ! // /// FAIL ! // ?String x1 = null; ! // if ( (x1 = "abc") == null) ! // x1 = x1 + ""; /// PASS |
From: Artem Gr K. <ar...@us...> - 2005-03-07 08:17:02
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20664/testsuite/compiler/typing Modified Files: dti.testsuite Log Message: Nullness analisys on assignments is partially implemented (RFE 681385). Index: dti.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/dti.testsuite,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dti.testsuite 6 Mar 2005 17:44:46 -0000 1.4 --- dti.testsuite 7 Mar 2005 08:16:52 -0000 1.5 *************** *** 13,16 **** --- 13,25 ---- /// PASS bug + // Nullness analysis on assignments. RFE# 681385 + func( null ).append( "123" ); + /// Toplevel + StringBuffer func( ?StringBuffer foo ) { + if( foo == null ) foo = new StringBuffer( 22 ); + return foo.append( "bar" ); + } + + /// PASS bug ?String s = null; if(maybeTrue()) *************** *** 47,51 **** foo(); ! /// PASS bug ?String s = maybeString(); ?String t = null; --- 56,60 ---- foo(); ! /// PASS ?String s = maybeString(); ?String t = null; *************** *** 135,137 **** func(); } - \ No newline at end of file --- 144,145 ---- |
From: Artem Gr K. <ar...@us...> - 2005-03-07 08:13:45
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19908 Modified Files: build.xml Log Message: Execution of testsuite is now possible after "compiler1" (stdlib sourcepath absence is fixed). Index: build.xml =================================================================== RCS file: /cvsroot/nice/Nice/build.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build.xml 4 Mar 2005 21:36:08 -0000 1.3 --- build.xml 7 Mar 2005 08:13:34 -0000 1.4 *************** *** 2,8 **** <!-- The file was formatted automatically by Eclipse 3.1.0 with maximum line width set to 110. --> <project name="Nice" default="check"> - <!-- For Nice arguments see "http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/NicecAntTaskdef". --> <property environment="env" /> <property name="compiler" value="modern" description="example: ant -Dcompiler=gcj" /> <property name="build" value="classes" /> <property name="javaccVersion" value="javacc-3.2" /> --- 2,8 ---- <!-- The file was formatted automatically by Eclipse 3.1.0 with maximum line width set to 110. --> <project name="Nice" default="check"> <property environment="env" /> <property name="compiler" value="modern" description="example: ant -Dcompiler=gcj" /> + <property name="jvmArgs" value="-Xms64m -Xmx128m" description="JVM options for speed" /> <property name="build" value="classes" /> <property name="javaccVersion" value="javacc-3.2" /> *************** *** 11,15 **** <path id="freshNice"> <pathelement path="${build}" /> - <pathelement path="${build}/console.jar" /> </path> --- 11,14 ---- *************** *** 46,51 **** <attribute name="package" /> <attribute name="runtime" default="${NICE_JAR}" /> ! <attribute name="args" default="--recompile-all" /> ! <attribute name="sourcepath" default="src" /> <sequential> <java failonerror="yes" --- 45,50 ---- <attribute name="package" /> <attribute name="runtime" default="${NICE_JAR}" /> ! <attribute name="args" default="" /> ! <attribute name="sourcepath" default="src${path.separator}stdlib" /> <sequential> <java failonerror="yes" *************** *** 54,61 **** --- 53,62 ---- classname="nice.tools.compiler.console.dispatch" > + <jvmarg line="${jvmArgs}" /> <arg value="--sourcepath" /> <arg value="@{sourcepath}" /> <arg value="--destination" /> <arg value="${build}" /> + <arg value="--exclude-runtime" /> <arg line="@{args}" /> <arg value="@{package}" /> *************** *** 65,69 **** <macrodef name="mac-nicec-new"> <attribute name="package" /> ! <attribute name="runtime" default="${build}/console.jar${path.separator}${build}" /> <attribute name="args" default="" /> <attribute name="sourcepath" default="src${path.separator}stdlib" /> --- 66,70 ---- <macrodef name="mac-nicec-new"> <attribute name="package" /> ! <attribute name="runtime" default="${build}" /> <attribute name="args" default="" /> <attribute name="sourcepath" default="src${path.separator}stdlib" /> *************** *** 74,77 **** --- 75,79 ---- classname="nice.tools.compiler.console.dispatch" > + <jvmarg line="${jvmArgs}" /> <arg value="--sourcepath" /> <arg value="@{sourcepath}" /> *************** *** 107,111 **** /> <mac-javac-single includes="nice/tools/util/System.java" /> ! <mac-nicec-old package="nice.tools.repository" /> <mac-javac-multi> <include> --- 109,113 ---- /> <mac-javac-single includes="nice/tools/util/System.java" /> ! <mac-nicec-old package="nice.tools.repository" args="-R" /> <mac-javac-multi> <include> *************** *** 122,127 **** </mac-javac-multi> <mac-javac-single includes="nice/lang/inline/*.java" /> ! <mac-nicec-old package="bossa.modules" /> ! <mac-nicec-old package="nice.tools.ast" /> <mac-javac-single includes="bossa/syntax/*.java" /> <move file="src/bossa/syntax/dispatch.java" --- 124,129 ---- </mac-javac-multi> <mac-javac-single includes="nice/lang/inline/*.java" /> ! <mac-nicec-old package="bossa.modules" args="-R" /> ! <mac-nicec-old package="nice.tools.ast" args="-r" /> <mac-javac-single includes="bossa/syntax/*.java" /> <move file="src/bossa/syntax/dispatch.java" *************** *** 130,134 **** /> <delete file="${build}/bossa/syntax/dispatch.class" /> ! <mac-nicec-old package="bossa.syntax" /> </target> <target name="javacc-download" unless="haveJavacc"> --- 132,136 ---- /> <delete file="${build}/bossa/syntax/dispatch.class" /> ! <mac-nicec-old package="bossa.syntax" args="-r" /> </target> <target name="javacc-download" unless="haveJavacc"> *************** *** 193,203 **** </manifest> </target> ! <target name="compiler1" depends="setDate,initialize"> ! <mac-nicec-old package="bossa.syntax" /> ! <mac-nicec-old package="nice.tools.compiler.console" args="--recompile-all --jar ${build}/console.jar" /> </target> <target name="compiler2"> ! <mac-nicec-new package="bossa.syntax" args="--recompile-all" /> ! <mac-nicec-new package="nice.tools.compiler.console" args="--recompile-all --jar ${build}/console.jar" /> </target> <target name="tools" depends="initialize"> --- 195,214 ---- </manifest> </target> ! <target name="compiler1" ! depends="core-bootstrap,javacc,parser,recompile,setDate,initialize" ! description="build intermediate compiler" ! > ! <mac-nicec-old package="bossa.syntax" args="-r" /> ! <mac-nicec-old package="nice.tools.compiler.console" args="-R" /> ! <!-- ! Make a snapshot of the compiler. ! It isn't used, but the "check" target will see that the file exists ! and will not try to recompile everything. ! --> ! <antcall target="makeArchive" /> </target> <target name="compiler2"> ! <mac-nicec-new package="bossa.syntax" args="-R" /> ! <mac-nicec-new package="nice.tools.compiler.console" args="-R" /> </target> <target name="tools" depends="initialize"> *************** *** 227,240 **** <mac-nicec-new package="nice.io" /> </target> ! <target name="bootstrap" ! depends="core-bootstrap,javacc,parser,recompile,compiler1,compiler2,tools,libs,recompile" ! /> <!-- The end of bootstrap targets. --> ! <available file="${build}/nice.jar" property="haveArchive" /> ! <target name="archive" unless="haveArchive"> ! <antcall target="bootstrap" /> <jar destfile="${build}/nice.jar" duplicate="preserve" manifest="src/nice/tools/compiler/Manifest"> - <zipfileset src="${build}/console.jar" /> <fileset dir="${build}"> <include name="nice/**" /> --- 238,247 ---- <mac-nicec-new package="nice.io" /> </target> ! <target name="bootstrap" depends="compiler1,compiler2,tools,libs,recompile" /> <!-- The end of bootstrap targets. --> ! <target name="makeArchive"> ! <delete file="${build}/nice.jar" /> <jar destfile="${build}/nice.jar" duplicate="preserve" manifest="src/nice/tools/compiler/Manifest"> <fileset dir="${build}"> <include name="nice/**" /> *************** *** 245,248 **** --- 252,260 ---- </jar> </target> + <available file="${build}/nice.jar" property="haveArchive" /> + <target name="archive" unless="haveArchive"> + <antcall target="bootstrap" /> + <antcall target="makeArchive" /> + </target> <target name="jar" depends="archive" description="compile and put Nice compiler into share/java/nice.jar"> *************** *** 256,269 **** </target> <target name="check_compiler" depends="archive,testengine"> ! <java classpathref="freshNice" classname="nice.tools.testsuite.TestNice" failonerror="${checkFail}"> ! <arg value="-runtime" /> ! <arg value="${build}" /> <arg value="testsuite/compiler" /> </java> </target> <target name="check_lib" depends="archive,testengine"> ! <java classpathref="freshNice" classname="nice.tools.testsuite.TestNice" failonerror="${checkFail}"> ! <arg value="-runtime" /> ! <arg value="${build}" /> <arg value="testsuite/lib" /> </java> --- 268,287 ---- </target> <target name="check_compiler" depends="archive,testengine"> ! <java classpathref="freshNice" ! classname="nice.tools.testsuite.TestNice" ! fork="yes" ! failonerror="${checkFail}" ! > ! <jvmarg line="${jvmArgs}" /> <arg value="testsuite/compiler" /> </java> </target> <target name="check_lib" depends="archive,testengine"> ! <java classpathref="freshNice" ! classname="nice.tools.testsuite.TestNice" ! fork="yes" ! failonerror="${checkFail}" ! > ! <jvmarg line="${jvmArgs}" /> <arg value="testsuite/lib" /> </java> |
From: Daniel B. <bo...@us...> - 2005-03-06 17:44:55
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29869/testsuite/compiler/typing Modified Files: dti.testsuite Log Message: Check that nullness inference is not too optimistic with if when only the second branch guarantees non-nullness. Index: dti.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/dti.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dti.testsuite 6 Mar 2005 17:24:27 -0000 1.3 --- dti.testsuite 6 Mar 2005 17:44:46 -0000 1.4 *************** *** 30,33 **** --- 30,42 ---- s. /*/// FAIL HERE*/ substring(1); + /// FAIL + ?String s = null; + if(maybeTrue()) + s = null; + else + s = "abc"; + + s. /*/// FAIL HERE*/ substring(1); + /// PASS bug ?String s = maybeString(); |
From: Daniel B. <bo...@us...> - 2005-03-06 17:24:36
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24293/testsuite/compiler/typing Modified Files: dti.testsuite Log Message: Fix testcase to avoid catching twice the same class of exception. Index: dti.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/dti.testsuite,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dti.testsuite 13 Aug 2004 17:11:36 -0000 1.2 --- dti.testsuite 6 Mar 2005 17:24:27 -0000 1.3 *************** *** 111,115 **** } catch (Exception e) { s = null; ! } catch (Exception e) { s = "xyz"; } finally { --- 111,115 ---- } catch (Exception e) { s = null; ! } catch (Throwable e) { s = "xyz"; } finally { |
From: Daniel B. <bo...@us...> - 2005-03-06 15:57:21
|
Update of /cvsroot/nice/Nice/src/nice/tools/visibility In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3204/src/nice/tools/visibility Modified Files: tests.nice impl.nice Log Message: Fix removal of 'general' symbols. Index: impl.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/visibility/impl.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** impl.nice 6 Mar 2005 15:52:07 -0000 1.2 --- impl.nice 6 Mar 2005 15:57:10 -0000 1.3 *************** *** 46,50 **** { map.remove(key, value); ! publicMap.remove(key, value); } --- 46,54 ---- { map.remove(key, value); ! ! if (parent != null) ! notNull(parent).remove(key, value); ! else ! publicMap.remove(key, value); } Index: tests.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/visibility/tests.nice,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tests.nice 6 Mar 2005 15:52:07 -0000 1.3 --- tests.nice 6 Mar 2005 15:57:10 -0000 1.4 *************** *** 230,233 **** --- 230,239 ---- res = root2.get("g"); assert res.size == 1 && res[0] == 'g'; + + inner1.remove("g", 'g'); + res = inner2.get("g"); + assert res.size == 0; + res = root2.get("g"); + assert res.size == 0; } |
From: Daniel B. <bo...@us...> - 2005-03-06 15:52:16
|
Update of /cvsroot/nice/Nice/src/nice/tools/visibility In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1884/src/nice/tools/visibility Modified Files: tests.nice impl.nice Log Message: Put 'general' symbols at the highest possible level so their are viewed globally. Index: impl.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/visibility/impl.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** impl.nice 6 Mar 2005 12:55:56 -0000 1.1 --- impl.nice 6 Mar 2005 15:52:07 -0000 1.2 *************** *** 20,24 **** private <Sym> ?List<Sym> maybeGet(?Scope<Sym> s, String key) = ! s == null ? null : s.map[key]; add(Scope this, key, value, visibility) = map.add(key, value); --- 20,24 ---- private <Sym> ?List<Sym> maybeGet(?Scope<Sym> s, String key) = ! s == null ? null : (s.map[key] || s.opens[key] || s.parent.maybeGet(key)); add(Scope this, key, value, visibility) = map.add(key, value); *************** *** 31,36 **** add(Scope this, key, value, general) { ! super; ! publicMap.add(key, value); } --- 31,44 ---- add(Scope this, key, value, general) { ! // Put the symbol at the highest possible level ! if (parent != null) ! notNull(parent).add(key, value, general); ! else ! { ! // General implies familial ! this.add(key, value, familial); ! ! publicMap.add(key, value); ! } } *************** *** 45,49 **** <Sym> get(Scope this, root, key) = this.getScope(root).maybeGet(key) || empty; ! <Sym> get(Scope this, key) = map[key] || parent.maybeGet(key) || opens[key] || empty; <Sym> ?List<Sym> get(List<Scope<Sym>> scopes, String key) --- 53,57 ---- <Sym> get(Scope this, root, key) = this.getScope(root).maybeGet(key) || empty; ! <Sym> get(Scope this, key) = this.maybeGet(key) || empty; <Sym> ?List<Sym> get(List<Scope<Sym>> scopes, String key) Index: tests.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/visibility/tests.nice,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tests.nice 6 Mar 2005 13:28:11 -0000 1.2 --- tests.nice 6 Mar 2005 15:52:07 -0000 1.3 *************** *** 201,204 **** --- 201,235 ---- } + void _testNestedVisibility() + { + Scope<char> root1 = new Scope(name: "root1", parent: null); + Scope<char> inner1 = new Scope(name: "inner1", parent: root1); + + Scope<char> root2 = new Scope(name: "root2", parent: null); + Scope<char> inner2 = new Scope(name: "inner2", parent: root2); + + root2.addImplicitOpen(root1); + + List<char> res; + + inner1.add("i", 'i', intimate); + res = inner2.get("i"); + assert res.size == 0; + res = root2.get("i"); + assert res.size == 0; + + inner1.add("f", 'f', familial); + res = inner2.get("f"); + assert res.size == 0; + res = root2.get("f"); + assert res.size == 0; + + inner1.add("g", 'g', general); + res = inner2.get("g"); + assert res.size == 1 && res[0] == 'g'; + res = root2.get("g"); + assert res.size == 1 && res[0] == 'g'; + } + void _testGeneralVisibility() { |
From: Daniel B. <bo...@us...> - 2005-03-06 13:59:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7643/src/bossa/syntax Modified Files: VarScope.java Log Message: Local var scopes can have at most one binding per name. Drop HashMultiTable. Index: VarScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** VarScope.java 6 Mar 2005 12:55:57 -0000 1.23 --- VarScope.java 6 Mar 2005 13:59:30 -0000 1.24 *************** *** 64,68 **** { this.outer = outer; ! this.defs = new HashMultiTable(); } --- 64,68 ---- { this.outer = outer; ! this.defs = new HashMap(); } *************** *** 80,84 **** void removeSymbol(/*VarSymbol*/Symbol sym) { ! defs.remove(sym.name, sym); } --- 80,84 ---- void removeSymbol(/*VarSymbol*/Symbol sym) { ! defs.remove(sym.name); } *************** *** 92,104 **** public List lookup(LocatedString i) { ! List res = defs.getAll(i); ! ! if(res!=null) ! return res; ! if(outer!=null) return outer.lookup(i); ! return new LinkedList(); } --- 92,108 ---- public List lookup(LocatedString i) { ! Object res = defs.get(i); ! ! if (res != null) ! { ! LinkedList l = new LinkedList(); ! l.add(res); ! return l; ! } ! if(outer!=null) return outer.lookup(i); ! return Collections.EMPTY_LIST; } *************** *** 114,124 **** * Debugging ****************************************************************/ ! public String toString() { ! return defs.elementCount()+";;\n"+outer; } ! private VarScope outer; ! private HashMultiTable defs; } --- 118,128 ---- * Debugging ****************************************************************/ ! public String toString() { ! return defs.size()+";;\n"+outer; } ! private VarScope outer; ! private HashMap defs; } |
From: Daniel B. <bo...@us...> - 2005-03-06 13:59:42
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7643/src/bossa/util Removed Files: HashMultiTable.java Log Message: Local var scopes can have at most one binding per name. Drop HashMultiTable. --- HashMultiTable.java DELETED --- |
From: Daniel B. <bo...@us...> - 2005-03-06 13:28:24
|
Update of /cvsroot/nice/Nice/src/nice/tools/visibility In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1075/src/nice/tools/visibility Modified Files: tests.nice Log Message: Added unit test for remove. Index: tests.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/visibility/tests.nice,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tests.nice 6 Mar 2005 12:55:56 -0000 1.1 --- tests.nice 6 Mar 2005 13:28:11 -0000 1.2 *************** *** 38,41 **** --- 38,45 ---- res = s.get("a"); assert res.size == 2 && res.contains('b') && res.contains('c'); + + s.remove("a", 'b'); + res = s.get("a"); + assert res.size == 1 && res[0] == 'c'; } |
From: Daniel B. <bo...@us...> - 2005-03-06 13:12:58
|
Update of /cvsroot/nice/Nice/testsuite/compiler/visibility/expressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28766/testsuite/compiler/visibility/expressions Added Files: public.testsuite Log Message: Check that packages cannot see unqualified public expression symbols from packages they have not imported. --- NEW FILE: public.testsuite --- /// FAIL bug /// package a /// Toplevel public void fooA() {} /// package b import a dontcompile /// Toplevel public void fooB() {} /// package c import a dontcompile // We haven't imported b /*/// FAIL HERE */ fooB(); /// package d import b,c {} /// FAIL /// package a /// Toplevel public void fooA() {} /// package b import a dontcompile /// Toplevel public void fooB() {} /// package c import a dontcompile // We haven't imported b /*/// FAIL HERE */ fooB(); /// package d import c,b {} |
From: Daniel B. <bo...@us...> - 2005-03-06 13:10:15
|
Update of /cvsroot/nice/Nice/testsuite/compiler/visibility/expressions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27928/testsuite/compiler/visibility/expressions Log Message: Directory /cvsroot/nice/Nice/testsuite/compiler/visibility/expressions added to the repository |
From: Daniel B. <bo...@us...> - 2005-03-06 13:09:48
|
Update of /cvsroot/nice/Nice/testsuite/compiler/visibility In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27823/testsuite/compiler/visibility Log Message: Directory /cvsroot/nice/Nice/testsuite/compiler/visibility added to the repository |
From: Daniel B. <bo...@us...> - 2005-03-06 13:08:19
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27403/src/nice/tools/testsuite Modified Files: NiceSourceFile.java Log Message: Respect the order in which imports have been specified so that import order can be specified by the testcase. Index: NiceSourceFile.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/NiceSourceFile.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NiceSourceFile.java 5 Aug 2004 12:33:21 -0000 1.19 --- NiceSourceFile.java 6 Mar 2005 13:07:58 -0000 1.20 *************** *** 81,86 **** * */ ! private Set _imports = new HashSet(); ! /** * TODO --- 81,86 ---- * */ ! private List _imports = new LinkedList(); ! /** * TODO |
From: Daniel B. <bo...@us...> - 2005-03-06 12:56:12
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24573/src/bossa/syntax Modified Files: tools.nice scope.nice VarScope.java Node.java Log Message: Added the nice.tools.visibility package. Use it for global scoping of (non-type) symbols. No functionality change yet. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** tools.nice 6 Mar 2005 01:34:26 -0000 1.104 --- tools.nice 6 Mar 2005 12:55:57 -0000 1.105 *************** *** 220,223 **** --- 220,226 ---- GlobalVarScope javaScope() = native Module.javaScope; + void addSymbol(VarScope, VarSymbol) = native void VarScope.addSymbol(Symbol); + void removeSymbol(VarScope, VarSymbol) = native void VarScope.removeSymbol(Symbol); + // Local Variables: // nice-xprogram: "../bin/nicec -d ../classes" Index: Node.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Node.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Node.java 6 Mar 2005 01:34:26 -0000 1.68 --- Node.java 6 Mar 2005 12:55:57 -0000 1.69 *************** *** 171,176 **** this.typeScope = typeOuter; break; ! case down: ! this.scope = new VarScope(outer,varSymbols); this.typeScope = new TypeScope(typeOuter); break; --- 171,176 ---- this.typeScope = typeOuter; break; ! case down: ! this.scope = VarScope.create(outer, varSymbols); this.typeScope = new TypeScope(typeOuter); break; *************** *** 182,189 **** this.typeScope = typeOuter; break; ! case upper: if(outer==null) ! outer = new VarScope(null); outer.addSymbols(varSymbols); this.scope = outer; --- 182,189 ---- this.typeScope = typeOuter; break; ! case upper: if(outer==null) ! outer = VarScope.create(null); outer.addSymbols(varSymbols); this.scope = outer; Index: VarScope.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/VarScope.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** VarScope.java 6 Mar 2005 01:34:26 -0000 1.22 --- VarScope.java 6 Mar 2005 12:55:57 -0000 1.23 *************** *** 22,45 **** @author Daniel Bonniot (d.b...@ma...) */ ! public class VarScope { ! public VarScope(VarScope outer) ! { ! this.outer = outer; ! this.defs = new HashMultiTable(); ! } ! ! public VarScope(VarScope outer, ! Collection /* of VarSymbol */ defs) ! { ! this(outer); ! addSymbols(defs); ! } - void addSymbol(/*VarSymbol*/Symbol s) - { - this.defs.put(s.name,s); - } - /** Adds a collection of VarSymbols --- 22,29 ---- @author Daniel Bonniot (d.b...@ma...) */ ! public abstract class VarScope { ! abstract void addSymbol(/*VarSymbol*/Symbol s); /** Adds a collection of VarSymbols *************** *** 57,61 **** } } ! void removeSymbol(/*VarSymbol*/Symbol sym) { --- 41,81 ---- } } ! ! abstract void removeSymbol(/*VarSymbol*/Symbol sym); ! ! public abstract List lookup(LocatedString i); ! ! abstract List globalLookup(LocatedString i); ! ! static VarScope create(VarScope outer) ! { ! return new LocalVarScope(outer); ! } ! ! static VarScope create(VarScope outer, Collection /* of VarSymbol */ defs) ! { ! return new LocalVarScope(outer, defs); ! } ! } ! ! class LocalVarScope extends VarScope ! { ! public LocalVarScope(VarScope outer) ! { ! this.outer = outer; ! this.defs = new HashMultiTable(); ! } ! ! public LocalVarScope(VarScope outer, Collection /* of VarSymbol */ defs) ! { ! this(outer); ! addSymbols(defs); ! } ! ! void addSymbol(/*VarSymbol*/Symbol s) ! { ! this.defs.put(s.name,s); ! } ! void removeSymbol(/*VarSymbol*/Symbol sym) { Index: scope.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/scope.nice,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** scope.nice 6 Mar 2005 01:34:26 -0000 1.4 --- scope.nice 6 Mar 2005 12:55:57 -0000 1.5 *************** *** 13,36 **** package bossa.syntax; /** The global scope of symbols. - */ public class GlobalVarScope extends VarScope { ! lookup(i) { // If there is any method by that name waiting, load it. ! loadJavaMethods(i.toString(), this); ! return super; } ! globalLookup(i) = this.lookup(i); } VarScope createGlobalVarScope() { ! return new GlobalVarScope(null); } --- 13,50 ---- package bossa.syntax; + import nice.tools.visibility; + /** The global scope of symbols. */ public class GlobalVarScope extends VarScope { ! private Scope<VarSymbol> impl = new Scope(name: "", parent: null); ! ! addSymbol(VarSymbol sym) = impl.add(sym.getName().toString(), sym); ! ! removeSymbol(VarSymbol sym) = impl.remove(sym.getName().toString(), sym); ! ! lookup(LocatedString name) { + let s = name.toString(); + // If there is any method by that name waiting, load it. ! loadJavaMethods(s, this); ! let res = impl[s]; ! ! if (res == null) ! return Collections.EMPTY_LIST; ! else ! return new LinkedList(res); } ! globalLookup(name) = this.lookup(name); } VarScope createGlobalVarScope() { ! return new GlobalVarScope(); } |