nice-commit Mailing List for The Nice Programming Language (Page 125)
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: <ar...@us...> - 2003-02-25 12:31:35
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv9231/F:/nice/src/bossa/syntax Modified Files: Pattern.java Log Message: Added dispatch on integer and character literals. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Pattern.java 20 Feb 2003 15:09:34 -0000 1.39 --- Pattern.java 25 Feb 2003 12:30:56 -0000 1.40 *************** *** 67,70 **** --- 67,71 ---- this.exactlyAt = exactlyAt; this.location = location; + if (tc != null) { *************** *** 83,86 **** --- 84,117 ---- } } + else if (atValue != null && atValue instanceof ConstantExp) + { + this.atIntValue = true; + String typeName = ""; + Object val = ((ConstantExp)atValue).value; + + if (val instanceof Byte) { + this.value = ((Byte)val).byteValue(); + typeName = "byte"; + } + else if (val instanceof Short) { + this.value = ((Short)val).shortValue(); + typeName = "short"; + } + else if (val instanceof Character) { + this.value = ((Character)val).charValue(); + typeName = "char"; + } + else if (val instanceof Integer) { + this.value = ((Integer)val).intValue(); + typeName = "int"; + } + else if (val instanceof Long) { + this.value = ((Long)val).longValue(); + typeName = "long"; + } + this.typeConstructor = + new TypeIdent(new LocatedString(typeName,location)); + } + } *************** *** 102,105 **** --- 133,145 ---- } + Pattern(TypeConstructor tc, Expression atValue, long value) + { + this.tc = tc; + this.atValue = atValue; + this.value = value; + this.atIntValue = true; + } + + final mlsub.typing.Monotype getType() { *************** *** 283,286 **** --- 323,329 ---- return that.tc == PrimitiveType.boolTC; + if (that.atIntValue) + return this.atIntValue && (this.value == that.value); + if (this.tc == that.tc) return this.exactlyAt || ! that.exactlyAt; *************** *** 301,304 **** --- 344,350 ---- return false; + if (atIntValue) + return false; + if (tag == PrimitiveType.trueBoolTC) { *************** *** 321,324 **** --- 367,379 ---- } + public boolean matchesValue(long val) + { + if (atAny()) + return true; + if (atIntValue) + return this.value == val; + return atPrimTypeFitting(val); + } + /**************************************************************** * Printing *************** *** 331,335 **** if (atAny()) return "@_"; ! if (atBool()) return "@" + atValue.toString(); StringBuffer res = new StringBuffer(); --- 386,390 ---- if (atAny()) return "@_"; ! if (atBool() || atIntValue) return "@" + atValue.toString(); StringBuffer res = new StringBuffer(); *************** *** 369,372 **** --- 424,433 ---- return "@" + atValue.toString(); + if (atIntValue) + if (tc == PrimitiveType.charTC) + return "@" + atValue.toString(); + else + return "@" + (value >= 0 ? "+" : "") + Long.toString(value); + return (exactlyAt ? "#" : "@") *************** *** 406,409 **** --- 467,492 ---- Expression atValue = null; + if (name.length() > 1) + { + if (name.charAt(0) == '\'') + { + atValue = ConstantExp.makeChar(new LocatedString(name.substring(1,name.length()-1),Location.nowhere())); + return new Pattern(PrimitiveType.charTC, atValue, ((Character)((ConstantExp)atValue).value).charValue()); + } + if (name.charAt(0) == '+' || name.charAt(0) == '-') + { + if (name.charAt(0) == '+') + name = name.substring(1); + Object val = ((ConstantExp)ConstantExp.makeNumber(new LocatedString(name,Location.nowhere()))).value; + if (val instanceof Byte) + return new Pattern(PrimitiveType.byteTC, null, ((Byte)val).byteValue()); + if (val instanceof Short) + return new Pattern(PrimitiveType.shortTC, null, ((Short)val).shortValue()); + if (val instanceof Integer) + return new Pattern(PrimitiveType.intTC, null, ((Integer)val).intValue()); + return new Pattern(PrimitiveType.longTC, null, ((Long)val).longValue()); + } + } + if (name.equals("_")) tc = null; *************** *** 451,454 **** --- 534,542 ---- } + if (atIntValue) + return Inline.inline(nice.lang.inline.CompOp.create("lEq"), + new gnu.expr.QuoteExp(new Long(value), gnu.bytecode.Type.long_type), + parameter); + gnu.bytecode.Type ct = nice.tools.code.Types.javaType(tc); *************** *** 488,491 **** --- 576,582 ---- private Location location; + public long value; + public boolean atIntValue = false; + public boolean atNull() { return atValue == NullExp.instance; } public boolean atAny() { return atValue == null && tc == null; } *************** *** 499,501 **** --- 590,600 ---- return atBool() && atValue.toString().equals("false"); } + public boolean atPrimTypeFitting(long val){ + return ( tc == PrimitiveType.longTC ) || + (tc == PrimitiveType.intTC && val >= Integer.MIN_VALUE && val <= Integer.MAX_VALUE) || + (tc == PrimitiveType.shortTC && val >= Short.MIN_VALUE && val <= Short.MAX_VALUE) || + (tc == PrimitiveType.charTC && val >= Character.MIN_VALUE && val <= Character.MAX_VALUE) || + (tc == PrimitiveType.byteTC && val >= Byte.MIN_VALUE && val <= Byte.MAX_VALUE); + } + } |
From: <ar...@us...> - 2003-02-25 12:31:03
|
Update of /cvsroot/nice/Nice/src/bossa/link In directory sc8-pr-cvs1:/tmp/cvs-serv9231/F:/nice/src/bossa/link Modified Files: Alternative.java Dispatch.java Log Message: Added dispatch on integer and character literals. Index: Alternative.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Alternative.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Alternative.java 10 Dec 2002 18:46:33 -0000 1.37 --- Alternative.java 25 Feb 2003 12:30:57 -0000 1.38 *************** *** 105,108 **** --- 105,127 ---- } + boolean matchesTypePart(TypeConstructor[] tags, boolean[] isValue) + { + for(int i = 0, n = 0; i < patterns.length; i++) + if (!isValue[i] && !patterns[i].matches(tags[n++])) + return false; + + return true; + } + + boolean matchesValuePart(long[] values, boolean[] isValue) + { + for(int i = 0, n = 0; i < patterns.length; i++) + if (isValue[i] && !patterns[i].matchesValue(values[n++])) + return false; + + return true; + } + + /**************************************************************** * Code generation Index: Dispatch.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** Dispatch.java 18 Feb 2003 14:21:20 -0000 1.49 --- Dispatch.java 25 Feb 2003 12:30:58 -0000 1.50 *************** *** 127,130 **** --- 127,134 ---- List multitags = enumerate(type, used); + boolean[] isValue = new boolean[method.getArity()]; + List values = generateValues(sortedAlternatives, isValue); + boolean hasValues = values.size() > 0; + int nb_errors = 0; for(Iterator i = multitags.iterator(); i.hasNext();) *************** *** 133,138 **** --- 137,149 ---- if (test(method, tags, sortedAlternatives)) + { if (++nb_errors > 9) break; + } + else if (hasValues && + testValues(method, tags, values, isValue, sortedAlternatives) ) + if (++nb_errors > 9) + break; + } if (nb_errors > 0) *************** *** 197,200 **** --- 208,263 ---- } + /** + Special version of above that tests tags with all combinations of integer values. + */ + private static boolean testValues(NiceMethod method, + TypeConstructor[] tags, + List valueCombis, + boolean[] isValue, + final Stack sortedAlternatives) + { + boolean failed = false; + List sortedTypeMatches = new ArrayList(); + for (Iterator i = sortedAlternatives.iterator(); i.hasNext(); ) + { + Alternative a = (Alternative) i.next(); + if (a.matchesTypePart(tags, isValue)) + sortedTypeMatches.add(a); + } + + for (Iterator valit = valueCombis.iterator(); valit.hasNext(); ) + { + Alternative first = null; + long[] values = (long[]) valit.next(); + for (Iterator i = sortedTypeMatches.iterator(); i.hasNext();) + { + Alternative a = (Alternative) i.next(); + if (a.matchesValuePart(values, isValue)) + if (first == null) + first = a; + else if (!Alternative.less(first, a)) + { + failed = true; + User.warning + (method, + "Ambiguity for method "+method+ + "\nFor parameters of type/value " + toString(tags, values, isValue)+ + "\nboth\n" + first.printLocated() + + "\nand\n" + a.printLocated() + "\nmatch."); + } + } + if(first==null) + { + failed = true; + User.warning(method, + "Method " + method + " is not completely covered:\n" + + "no alternative matches " + + toString(tags, values, isValue)); + } + } + return failed; + } + + private static String toString(TypeConstructor[] tags) { *************** *** 210,213 **** --- 273,293 ---- } + private static String toString(TypeConstructor[] tags, long[] values, boolean[] isValue) + { + StringBuffer res = new StringBuffer(); + res.append('('); + for (int i = 0, n = 0; i < tags.length; i++) + { + if(isValue[n]) + res.append(values[n++]); + else + res.append(tags[n++]); + if (i + 1 < tags.length) + res.append(", "); + } + return res.append(')').toString(); + } + + /** Enumerate all the tuples of tags in the domain of a polytype. *************** *** 337,339 **** --- 417,475 ---- return tags; } + + /** Generate all combinations of integer values from the alternatives + */ + private static List generateValues(List alternatives, boolean[] isValue) + { + List values = new ArrayList(); + if (alternatives.size() < 1) return values; + int len = isValue.length; + for (int pos = 0; pos < len; pos++) + { + long[] valuesAtPos = new long[alternatives.size()]; + int valueCount = 0; + for (Iterator i = alternatives.iterator(); i.hasNext(); ) + { + Pattern pat = ((Alternative)i.next()).getPatterns()[pos]; + if (pat.atIntValue) { + isValue[pos] = true; + valuesAtPos[valueCount++] = pat.value; + } + } + if (valueCount > 0) + { + List res = new ArrayList(); + //remove duplicates + for (int i = 0; i < valueCount; i++) + for (int j = i+1; j < valueCount; j++) + if (valuesAtPos[i] == valuesAtPos[j]) + valuesAtPos[i] = valuesAtPos[--valueCount]; + + if (values.size() == 0) + for (int i = 0; i < valueCount; i++) + { + long[] arr2 = new long[len]; + arr2[pos] = valuesAtPos[i]; + res.add(arr2); + } + + else + for (Iterator it = values.iterator(); it.hasNext(); ) + { + long[] arr = (long[])it.next(); + for (int i = 0; i < valueCount; i++) + { + long[] arr2 = new long[len]; + System.arraycopy(arr,0,arr2,0,len); + arr2[pos] = valuesAtPos[i]; + res.add(arr2); + } + } + + values = res; + } + } + return values; + } + } |
From: <ar...@us...> - 2003-02-25 12:27:06
|
Update of /cvsroot/nice/Nice/testsuite/compiler/methods In directory sc8-pr-cvs1:/tmp/cvs-serv8034/F:/nice/testsuite/compiler/methods Added Files: integer.testsuite Log Message: testsuite for dispatch on integers. --- NEW FILE: integer.testsuite --- /// PASS /// Toplevel long fac(long n); fac(n@long) = n*fac(n-1); fac(@1) = 1; /// PASS /// Toplevel int fib(int n); fib(n@int) = fib(n-2) + fib(n-1); fib(@1) = 1; fib(@2) = 1; /// FAIL /// Toplevel int ack(int x, int y); // missing (0,0) case ack(@0, y@int) = y+1; ack(x@int, @0) = ack(x-1, 1); ack(x@int, y@int) = ack(x-1, ack(x, y-1)); /// FAIL /// Toplevel String toStr(char); toStr(@char) = ""; toStr(@'a') = "a"; toStr(@'b') = "b"; toStr(@'a') = "a"; /// PASS /// package a assert(bar(-1)==1); /// Toplevel int bar(int); bar(n@int) = n; bar(@-1) = 1; bar(@-12389) = 12389; bar(@3920) = -3920; /// package b import a ; /// PASS /// package a /// Toplevel void foo(char); foo(@char) {} foo(@'a') {} /// package b import a ; /// FAIL /// Toplevel // The default case is missing void foo(short); foo(@0) {} foo(@1) {} /// PASS /// Toplevel // literals without @ int fib(int n); fib(n) = fib(n-2) + fib(n-1); fib(1) = 1; fib(2) = 1; /// PASS /// Toplevel // literals without @ String toStr(char); toStr(@char) = ""; toStr('a') = "a"; toStr('b') = "b"; |
From: <ar...@us...> - 2003-02-25 12:19:39
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv5461/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: The '@' before anonymous literal patterns is optional. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** Parser.jj 23 Feb 2003 12:21:32 -0000 1.143 --- Parser.jj 25 Feb 2003 12:19:34 -0000 1.144 *************** *** 1191,1198 **** --- 1191,1200 ---- { Pattern res = null; + Expression val = null; LocatedString i; } { ( res = anonymousPattern(null) + | val = patternLiteral() { res = new Pattern(null,null,val,false,null,null,val.location()); } | i = ident() ( res = anonymousPattern(i) | { res = new Pattern(i); } ) |
From: <ar...@us...> - 2003-02-23 12:21:35
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv23675/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Patterns can be negative integer literals. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** Parser.jj 23 Feb 2003 00:58:56 -0000 1.142 --- Parser.jj 23 Feb 2003 12:21:32 -0000 1.143 *************** *** 2142,2145 **** --- 2142,2149 ---- ( "null" { res = NullExp.instance; } + | "-" res=intConstantExp() + { res = ConstantExp.makeNumber( + new LocatedString("-"+res.toString(), res.location())); + } | res=intConstantExp() | res=charConstantExp() |
From: <ar...@us...> - 2003-02-23 11:04:25
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv10233/F:/nice/src/bossa/syntax Modified Files: NiceClass.java Log Message: Interfaces cannot have fields. Index: NiceClass.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NiceClass.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** NiceClass.java 12 Feb 2003 12:48:34 -0000 1.40 --- NiceClass.java 23 Feb 2003 11:04:22 -0000 1.41 *************** *** 82,85 **** --- 82,87 ---- boolean isFinal, boolean isTransient, boolean isVolatile) { + if (definition instanceof ClassDefinition.Interface) + User.error(sym, "An interface cannot have a field."); return new Field(sym, value, isFinal, isTransient, isVolatile); } |
From: <ar...@us...> - 2003-02-23 11:04:25
|
Update of /cvsroot/nice/Nice/testsuite/compiler/classes In directory sc8-pr-cvs1:/tmp/cvs-serv10233/F:/nice/testsuite/compiler/classes Modified Files: fields.testsuite Log Message: Interfaces cannot have fields. Index: fields.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/classes/fields.testsuite,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** fields.testsuite 20 Sep 2002 08:23:25 -0000 1.8 --- fields.testsuite 23 Feb 2003 11:04:22 -0000 1.9 *************** *** 87,88 **** --- 87,95 ---- () -> String f = () => ""; } + + /// FAIL + /// Toplevel + interface I + { + String s; + } |
From: <bo...@us...> - 2003-02-23 00:58:59
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv3052/src/bossa/parser Modified Files: Parser.jj Log Message: Factorize code for constant character expressions. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** Parser.jj 21 Feb 2003 21:51:26 -0000 1.141 --- Parser.jj 23 Feb 2003 00:58:56 -0000 1.142 *************** *** 1502,1505 **** --- 1502,1517 ---- } + Expression charConstantExp(): + { + Token t; + } + { + t = <CHARACTER_LITERAL> + { return ConstantExp.makeChar + (new LocatedString(t.image.substring(1, t.image.length() - 1), + new Location(t))); + } + } + StringConstantExp stringConstantExp(): { *************** *** 2115,2123 **** | res=intConstantExp() | res=floatConstantExp() ! | t=<CHARACTER_LITERAL> ! { res=ConstantExp.makeChar ! (new LocatedString(t.image.substring(1,t.image.length()-1), ! new Location(t))); ! } | res=stringConstantExp() ) --- 2127,2131 ---- | res=intConstantExp() | res=floatConstantExp() ! | res=charConstantExp() | res=stringConstantExp() ) *************** *** 2135,2143 **** "null" { res = NullExp.instance; } | res=intConstantExp() ! | t=<CHARACTER_LITERAL> ! { res=ConstantExp.makeChar ! (new LocatedString(t.image.substring(1,t.image.length()-1), ! new Location(t))); ! } ) { return res; } --- 2143,2147 ---- "null" { res = NullExp.instance; } | res=intConstantExp() ! | res=charConstantExp() ) { return res; } |
From: <bo...@us...> - 2003-02-22 11:28:46
|
Update of /cvsroot/nice/Nice/web In directory sc8-pr-cvs1:/tmp/cvs-serv30463 Modified Files: manual.xml Log Message: Added section on function calls. Index: manual.xml =================================================================== RCS file: /cvsroot/nice/Nice/web/manual.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** manual.xml 17 Feb 2003 13:45:00 -0000 1.12 --- manual.xml 22 Feb 2003 11:28:42 -0000 1.13 *************** *** 344,348 **** <section id="namedParameters"><title>Named parameters</title> <para> ! When calling a function (or a <link linkend="method">method</link>) it is possible to specify the name of a parameter, followed by <literal>:</literal> before the value given to that parameter. --- 344,349 ---- <section id="namedParameters"><title>Named parameters</title> <para> ! When <link linkend="call">calling</link> a function ! (or a <link linkend="method">method</link>) it is possible to specify the name of a parameter, followed by <literal>:</literal> before the value given to that parameter. *************** *** 698,701 **** --- 699,752 ---- <chapter><title>Expressions</title> + <section id="call"><title>Function calls</title> + <para> + A call is usually of the form <literal>f(e1, ..., en)</literal>. + <literal>f</literal> can be a function name, a method name, or + more generally any expression which has a functional type + (for instance, a local parameter). + <literal>e1, ..., en</literal> is the list of arguments to the + function. Arguments can optionally be + <link linkend="namedParameters">named</link>. + </para> + + <para> + In many object-oriented languages, methods are called with the + syntax <literal>e1.f(e2, ..., en)</literal>. This syntax is also + accepted in Nice, and is completely equivalent to the previous one. + In particular, <literal>e.f</literal> can be used to retrieve the value + of the field <literal>f</literal> in the object <literal>e</literal> + <footnote> + <para> + A consequence of these rules is that if the field + <literal>f</literal> contains a function, it must be called with + <literal>(e.f)(e1, ..., en)</literal>. + </para> + </footnote>. + </para> + + <para> + It is possible that a name refers to several unrelated functions. + In that case, the types (and if applicable names) + of the arguments are used to try to disambiguate which function + must be called. If only one function is applicable, it is called. + Moreoever, if several functions are applicable, but one has a more + restricted domain than all the others, it is chosen + <footnote> + <para> + For instance, suppose two functions + <literal><![CDATA[<T> void foo(Collection<T>)]]></literal> and + <literal><![CDATA[<T> void foo(List<T>)]]></literal> are declared, + and <literal>aList</literal> is an expression of static type + <literal>List</literal>. + The expression <literal>foo(aList)</literal> will result in + calling the second <literal>foo</literal> function, + because <literal>List</literal> + is a subclass of <literal>Collection</literal>. + </para> + </footnote>. + Otherwise, the compiler reports an ambiguity error. + </para> + </section> + <section><title>Tuples</title> <para> *************** *** 726,730 **** temporary variable, using tuples: <literal>(x, y) = (y, x)</literal>. An important use of tuples is to allow a function or a method ! to return several values. Example <xref linkend="tupleEx" /> defines and uses the function <literal>minMax</literal>, which takes two integers, and returns the smallest first, the biggest second. --- 777,781 ---- temporary variable, using tuples: <literal>(x, y) = (y, x)</literal>. An important use of tuples is to allow a function or a method ! to return several values. <xref linkend="tupleEx" /> defines and uses the function <literal>minMax</literal>, which takes two integers, and returns the smallest first, the biggest second. |
From: <ar...@us...> - 2003-02-21 21:51:30
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv32616/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Restricted the litarals used in patterns i.e. no floats or strings. Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** Parser.jj 21 Feb 2003 13:04:37 -0000 1.140 --- Parser.jj 21 Feb 2003 21:51:26 -0000 1.141 *************** *** 1211,1215 **** { ( ! t="@" ( val=Literal() | tc=typeIdent() ) | t="#" tc=typeIdent() { exactlyAt = true; } --- 1211,1215 ---- { ( ! t="@" ( val=patternLiteral() | tc=typeIdent() ) | t="#" tc=typeIdent() { exactlyAt = true; } *************** *** 1748,1752 **** { first=getToken(1); } ! ( LOOKAHEAD(funExp()) e1=funExp() | LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp() --- 1748,1752 ---- { first=getToken(1); } ! ( //TODO: simplify next lookahead after removal of the 'fun' keyword. LOOKAHEAD(funExp()) e1=funExp() | LOOKAHEAD(monoSymbol() "=>") e1=simpleVarFunExp() *************** *** 2121,2124 **** --- 2121,2143 ---- } | res=stringConstantExp() + ) + { return res; } + } + + Expression patternLiteral() : + //restricted literal for use in dispatch patterns + { + Expression res; + Token t; + } + { + ( + "null" { res = NullExp.instance; } + | res=intConstantExp() + | t=<CHARACTER_LITERAL> + { res=ConstantExp.makeChar + (new LocatedString(t.image.substring(1,t.image.length()-1), + new Location(t))); + } ) { return res; } |
From: <ar...@us...> - 2003-02-21 15:53:13
|
Update of /cvsroot/nice/Nice/testsuite/compiler/packages In directory sc8-pr-cvs1:/tmp/cvs-serv13727 Added Files: nicei.testsuite Log Message: added testcases for testing parsing of package.nicei files --- NEW FILE: nicei.testsuite --- /// COMMENT parse tests for package.nicei files. /// PASS /// package a /// toplevel var boolean var1 = false; class A { boolean b = !var1; } /// package b import a ; /// PASS /// package a /// toplevel var int var1 = 0; var int var2 = 1; class A { boolean b = var1 >= var2; } /// package b import a ; /// PASS /// package a /// toplevel var int var1 = 0; var int var2 = 1; class A { int i = var1 + var2; } /// package b import a ; /// PASS /// package a /// toplevel var int[] var1 = [1]; class A { int i = var1[0]; } /// package b import a ; |
From: <bo...@us...> - 2003-02-21 15:19:23
|
Update of /cvsroot/nice/Nice/testsuite/compiler/typing In directory sc8-pr-cvs1:/tmp/cvs-serv31587/testsuite/compiler/typing Modified Files: null.testsuite Log Message: Chech the ambiguity error when calling one of two function accepting null with the null parameter (this is NOT bug 679597). Index: null.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/typing/null.testsuite,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** null.testsuite 7 Oct 2002 14:02:24 -0000 1.5 --- null.testsuite 21 Feb 2003 15:19:20 -0000 1.6 *************** *** 29,30 **** --- 29,36 ---- /// Toplevel void f(?String, int ?-> int) {} + + /// FAIL + /* /// FAIL HERE */ f(null); + /// Toplevel + void f(?String) {} + void f(?java.io.File) {} |
From: <bo...@us...> - 2003-02-21 15:17:56
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite In directory sc8-pr-cvs1:/tmp/cvs-serv30742/src/nice/tools/testsuite Modified Files: TestCase.java NiceSourceFile.java Log Message: Correctly compute line number for code in the main section, when there is a toplevel section as well. Index: TestCase.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TestCase.java 19 Feb 2003 18:30:25 -0000 1.17 --- TestCase.java 21 Feb 2003 15:17:52 -0000 1.18 *************** *** 220,227 **** columnNum++; int lineNum = _lineCounter + _currentSourceFile.getCountImports() + 2; - if (_currentSourceFile.getStatus() == NiceSourceFile.STATUS_MAIN) - lineNum += 2; //System.out.println("_lineCounter: " + _lineCounter + " _currentSourceFile.getCountImports(): " + _currentSourceFile.getCountImports()); ! _failPositions.add(new FailPosition(_currentSourceFile.getFileName(), lineNum, columnNum + 1)); } } --- 220,230 ---- columnNum++; int lineNum = _lineCounter + _currentSourceFile.getCountImports() + 2; //System.out.println("_lineCounter: " + _lineCounter + " _currentSourceFile.getCountImports(): " + _currentSourceFile.getCountImports()); ! _failPositions.add ! (new FailPosition ! (_currentSourceFile.getFileName(), ! lineNum, columnNum + 1, ! _currentSourceFile, ! _currentSourceFile.getStatus() == NiceSourceFile.STATUS_MAIN)); } } *************** *** 476,484 **** private int _line; private int _column; ! FailPosition(String fileName, int line, int column) { _fileName = fileName; _line = line; _column = column; } --- 479,492 ---- private int _line; private int _column; + private NiceSourceFile _sourceFile; + private boolean _inMain; ! FailPosition(String fileName, int line, int column, ! NiceSourceFile sourceFile, boolean inMain) { _fileName = fileName; _line = line; _column = column; + _sourceFile = sourceFile; + _inMain = inMain; } *************** *** 488,492 **** protected int getLine() { ! return _line; } --- 496,505 ---- protected int getLine() { ! int res = _line; ! if (_inMain) ! // Add the number of lines of the toplevel code, ! // plus two lines for the main section header. ! res += _sourceFile.getTopLevelSectionLength() + 2; ! return res; } Index: NiceSourceFile.java =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/NiceSourceFile.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** NiceSourceFile.java 19 Feb 2003 18:30:28 -0000 1.15 --- NiceSourceFile.java 21 Feb 2003 15:17:53 -0000 1.16 *************** *** 59,62 **** --- 59,68 ---- */ private StringBuffer _mainMethodContent = new StringBuffer(); + + /** + * Number of lines writte for the main section. + */ + + private int _topLevelSectionLength = 0; /** * TODO *************** *** 151,156 **** --- 157,167 ---- public void addToTopLevel(String line) { _topLevelContent.append(line).append('\n'); + _topLevelSectionLength++; } + + public int getTopLevelSectionLength() { + return _topLevelSectionLength; + } /** |
From: <ar...@us...> - 2003-02-21 13:04:40
|
Update of /cvsroot/nice/Nice/src/bossa/parser In directory sc8-pr-cvs1:/tmp/cvs-serv2010/F:/nice/src/bossa/parser Modified Files: Parser.jj Log Message: Bugfix for printing operators in package.nicei. example: var boolean var1 = true; var boolean var2 = true; class A { boolean b = var1 && var2; } printed before in package.nicei: nice.lang.boolean b = &&(var1, var2); and now: nice.lang.boolean b = `&&`(var1, var2); Index: Parser.jj =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/parser/Parser.jj,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** Parser.jj 19 Feb 2003 21:16:30 -0000 1.139 --- Parser.jj 21 Feb 2003 13:04:37 -0000 1.140 *************** *** 36,42 **** class Parser { private static IdentExp symb(String name, Token t) { ! return new IdentExp(new LocatedString(name,new Location(t))); } private static IdentExp symb(Token t) --- 36,46 ---- class Parser { + private static IdentExp symb(String name, Token t, boolean quoted) + { + return new IdentExp(new LocatedString(name,new Location(t),quoted)); + } private static IdentExp symb(String name, Token t) { ! return symb(name,t,true); } private static IdentExp symb(Token t) *************** *** 2076,2080 **** { Token t; } t="[" res=Expression() "]" ! { return CallExp.create(symb("get",t),start,res); } | --- 2080,2084 ---- { Token t; } t="[" res=Expression() "]" ! { return CallExp.create(symb("get",t,false),start,res); } | |
From: <ar...@us...> - 2003-02-21 13:04:40
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv2010/F:/nice/src/bossa/syntax Modified Files: SymbolExp.java Log Message: Bugfix for printing operators in package.nicei. example: var boolean var1 = true; var boolean var2 = true; class A { boolean b = var1 && var2; } printed before in package.nicei: nice.lang.boolean b = &&(var1, var2); and now: nice.lang.boolean b = `&&`(var1, var2); Index: SymbolExp.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/SymbolExp.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SymbolExp.java 30 Jul 2002 02:13:32 -0000 1.29 --- SymbolExp.java 21 Feb 2003 13:04:36 -0000 1.30 *************** *** 99,103 **** public String toString() { ! return symbol.name.toString(); } --- 99,103 ---- public String toString() { ! return symbol.name.toQuotedString(); } |
From: <bo...@us...> - 2003-02-20 15:09:42
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv15372/src/bossa/syntax Modified Files: Pattern.java Log Message: Updated the error message. Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Pattern.java 20 Feb 2003 01:27:51 -0000 1.38 --- Pattern.java 20 Feb 2003 15:09:34 -0000 1.39 *************** *** 117,122 **** tc = typeConstructor.resolveToTC(scope); if (exactlyAt && TypeConstructors.isInterface(tc)) ! User.error(typeConstructor.location(), "Pattern #"+typeConstructor.toString()+ ! " can never be matched because instances of an interface don't exist."); typeConstructor = null; } --- 117,124 ---- tc = typeConstructor.resolveToTC(scope); if (exactlyAt && TypeConstructors.isInterface(tc)) ! User.error ! (typeConstructor.location(), ! "Pattern #" + typeConstructor + ! " cannot be matched because interfaces do not have direct instances."); typeConstructor = null; } |
From: <bo...@us...> - 2003-02-20 15:05:24
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang/inline In directory sc8-pr-cvs1:/tmp/cvs-serv13487/stdlib/nice/lang/inline Modified Files: Instanceof.java Log Message: Disable `instanceof` om primitive types (fixes #687308). Index: Instanceof.java =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/inline/Instanceof.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Instanceof.java 6 Jul 2002 10:42:30 -0000 1.1 --- Instanceof.java 20 Feb 2003 15:05:16 -0000 1.2 *************** *** 43,46 **** --- 43,50 ---- Type type = (Type) ((QuoteExp) args[1]).getValue(); + if (type instanceof PrimType) + throw new bossa.util.UserError + (exp, "instanceof cannot be used with primitive types"); + value.compile(comp, Target.pushObject); code.emitInstanceof(type); |
From: <bo...@us...> - 2003-02-20 15:05:24
|
Update of /cvsroot/nice/Nice/testsuite/compiler/native In directory sc8-pr-cvs1:/tmp/cvs-serv13487/testsuite/compiler/native Modified Files: instanceof.testsuite Log Message: Disable `instanceof` om primitive types (fixes #687308). Index: instanceof.testsuite =================================================================== RCS file: /cvsroot/nice/Nice/testsuite/compiler/native/instanceof.testsuite,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** instanceof.testsuite 24 Jul 2002 16:05:28 -0000 1.3 --- instanceof.testsuite 20 Feb 2003 15:05:15 -0000 1.4 *************** *** 27,28 **** --- 27,31 ---- if (0 instanceof String) throw new Error(); + + /// FAIL + boolean b = /* /// FAIL HERE */ 1 instanceof int; |
From: <bo...@us...> - 2003-02-20 14:58:44
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv10332/src/bossa/syntax Modified Files: tools.nice Statement.java Log Message: Allow error messages to be displayed during code generation. Index: tools.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/tools.nice,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tools.nice 17 Feb 2003 14:41:12 -0000 1.17 --- tools.nice 20 Feb 2003 14:58:39 -0000 1.18 *************** *** 62,67 **** bossa.util.Located loc) { ! if (e.responsible == null) ! e.responsible = loc; return e; } --- 62,67 ---- bossa.util.Located loc) { ! if (e.location == null) ! e.location = loc.location(); return e; } Index: Statement.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Statement.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Statement.java 20 Jan 2003 19:20:58 -0000 1.16 --- Statement.java 20 Feb 2003 14:58:39 -0000 1.17 *************** *** 52,57 **** // If not, it's better than nothing to located the error in // the containing statement. ! if (e.responsible == null) ! e.responsible = s; // Rethrow. throw e; --- 52,57 ---- // If not, it's better than nothing to located the error in // the containing statement. ! if (e.location == null) ! e.location = s.location(); // Rethrow. throw e; |
From: <bo...@us...> - 2003-02-20 14:58:44
|
Update of /cvsroot/nice/Nice/src/bossa/util In directory sc8-pr-cvs1:/tmp/cvs-serv10332/src/bossa/util Modified Files: UserError.java Location.java Log Message: Allow error messages to be displayed during code generation. Index: UserError.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/UserError.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UserError.java 12 Mar 2002 15:51:52 -0000 1.5 --- UserError.java 20 Feb 2003 14:58:38 -0000 1.6 *************** *** 31,47 **** public UserError(Located responsible, String message) { this(message); ! this.responsible = responsible; } public String getMessage() { ! if (responsible == null || responsible.location() == null) return message; else ! return responsible.location() + ":\n" + message; } public String message; ! public Located responsible; } --- 31,59 ---- public UserError(Located responsible, String message) { + this(responsible.location(), message); + } + + public UserError(gnu.expr.Expression responsible, String message) + { + this(new Location(responsible.getFile(), responsible.getLine(), + responsible.getColumn()), + message); + } + + public UserError(Location location, String message) + { this(message); ! this.location = location; } public String getMessage() { ! if (location == null) return message; else ! return location + ":\n" + message; } public String message; ! public Location location; } Index: Location.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/util/Location.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Location.java 20 Jan 2003 19:20:07 -0000 1.22 --- Location.java 20 Feb 2003 14:58:39 -0000 1.23 *************** *** 60,66 **** } public Location(String fileName) { ! this(fileName,-1,-1,-1,-1); } --- 60,71 ---- } + public Location(String fileName, int startLine, int startColumn) + { + this(fileName, startLine, startColumn, -1, -1); + } + public Location(String fileName) { ! this(fileName, -1, -1); } |
From: <bo...@us...> - 2003-02-20 14:58:42
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv10332/src/gnu/expr Modified Files: Compilation.java Log Message: Allow error messages to be displayed during code generation. Index: Compilation.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/Compilation.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Compilation.java 22 Oct 2002 18:24:38 -0000 1.17 --- Compilation.java 20 Feb 2003 14:58:37 -0000 1.18 *************** *** 1573,1576 **** --- 1573,1580 ---- catch (RuntimeException ex) { + // Rethrow the error, since it is better handled at the Nice level. + if (true) + throw ex; + // Try to produce a localized error message. error('f', "Internal compiler exception: "+ex); |
From: <ar...@us...> - 2003-02-20 11:54:53
|
Update of /cvsroot/nice/Nice/regtest/multipkg In directory sc8-pr-cvs1:/tmp/cvs-serv6780/F:/nice/regtest/multipkg Modified Files: import.nice Log Message: Removed the *last* 'fun' from regtest files to test the changes in the parser. Index: import.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/multipkg/import.nice,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** import.nice 20 Feb 2003 11:16:16 -0000 1.14 --- import.nice 20 Feb 2003 11:54:49 -0000 1.15 *************** *** 50,54 **** f3 : int x => f0.f2, f4 : int->int x => x(0), ! f5 : int->int x => fun(int y) => x(y), f6 : (int x, int y) => x - y, --- 50,54 ---- f3 : int x => f0.f2, f4 : int->int x => x(0), ! f5 : int->int x => int y => x(y), f6 : (int x, int y) => x - y, |
From: <ar...@us...> - 2003-02-20 11:16:20
|
Update of /cvsroot/nice/Nice/regtest/multipkg In directory sc8-pr-cvs1:/tmp/cvs-serv13372/F:/Nice/regtest/multipkg Modified Files: import.nice Log Message: Removed 'fun' from regtest files to test the changes in the parser. Index: import.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/multipkg/import.nice,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** import.nice 29 Apr 2002 14:38:20 -0000 1.13 --- import.nice 20 Feb 2003 11:16:16 -0000 1.14 *************** *** 33,37 **** polymorphic2(new regtest.basic.Multi()); ! iter(["A"], fun(String s)=> println(s)); /* Must fail: map(["A"], fun(String s)=>{println(s);}); */ --- 33,37 ---- polymorphic2(new regtest.basic.Multi()); ! iter(["A"], String s => println(s)); /* Must fail: map(["A"], fun(String s)=>{println(s);}); */ *************** *** 46,60 **** { Funs f = new Funs ! (f1 : fun(int x) => x, ! f2 : fun(int x) => f0.f1, ! f3 : fun(int x) => f0.f2, ! f4 : fun(int->int x) => x(0), ! f5 : fun(int->int x) => fun(int y) => x(y), ! f6 : fun(int x, int y) => x - y, f7 : null, f8 : null, ! f9 : fun(int x) => [x], f10 : [ f0.f1 ]); } --- 46,60 ---- { Funs f = new Funs ! (f1 : int x => x, ! f2 : int x => f0.f1, ! f3 : int x => f0.f2, ! f4 : int->int x => x(0), ! f5 : int->int x => fun(int y) => x(y), ! f6 : (int x, int y) => x - y, f7 : null, f8 : null, ! f9 : int x => [x], f10 : [ f0.f1 ]); } |
From: <ar...@us...> - 2003-02-20 11:16:20
|
Update of /cvsroot/nice/Nice/regtest/basic In directory sc8-pr-cvs1:/tmp/cvs-serv13372/F:/nice/regtest/basic Modified Files: arrays.nice higherOrder.nice main.nice syntax.nice Log Message: Removed 'fun' from regtest files to test the changes in the parser. Index: arrays.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/arrays.nice,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** arrays.nice 9 Sep 2002 12:59:27 -0000 1.18 --- arrays.nice 20 Feb 2003 11:16:14 -0000 1.19 *************** *** 92,98 **** { println(a.size()); ! int[] b = map(a, fun(int i) => i+4); p(b); ! p(filter(reverse(b), fun(int i)=> i>6)); long[] ls = map(a, id); --- 92,98 ---- { println(a.size()); ! int[] b = map(a, int i => i+4); p(b); ! p(filter(reverse(b), int i=> i>6)); long[] ls = map(a, id); *************** *** 115,126 **** ss[2] = "e2"; ss[4] = "e4"; p(ss); ! ?String[] ss2 = filter(ss, fun(?String s)=>s!=null); p(ss2); ! p(map(ss2, fun(?String s)=>{ String str = notNull(s); return str + str; })); ! iter(id(ss), fun(?String s)=>{}); // using an array that is the field of an object Fields f = new Fields(); ! notNull(f.strings).iter(fun(?String s)=>println(s)); Collection<?String> c = ss; --- 115,126 ---- ss[2] = "e2"; ss[4] = "e4"; p(ss); ! ?String[] ss2 = filter(ss, ?String s=>s!=null); p(ss2); ! p(map(ss2, ?String s =>{ String str = notNull(s); return str + str; })); ! iter(id(ss), ?String s =>{}); // using an array that is the field of an object Fields f = new Fields(); ! notNull(f.strings).iter(?String s =>println(s)); Collection<?String> c = ss; *************** *** 144,151 **** // Literal arrays String[] ts = [ "A", "B" ]; ! ts.iter(fun(String s)=>println(s)); float[] tf = [ 1.5, 2, 3.7 ]; ! tf.iter(fun(float f)=>println(f+1)); } --- 144,151 ---- // Literal arrays String[] ts = [ "A", "B" ]; ! ts.iter( String s =>println(s)); float[] tf = [ 1.5, 2, 3.7 ]; ! tf.iter( float f =>println(f+1)); } Index: higherOrder.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/higherOrder.nice,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** higherOrder.nice 3 May 2002 14:47:04 -0000 1.7 --- higherOrder.nice 20 Feb 2003 11:16:14 -0000 1.8 *************** *** 26,31 **** { println(id("ID")); ! println((fun<Any T>(T x)=>x)("LAMBDA")); ! println(apply(fun<Any T>(T x)=>x, "LAMBDA")); println(apply(nativeToString, "Using native methods as first class values")); println(apply(id(intIdentity), 42)); --- 26,31 ---- { println(id("ID")); ! println((<Any T>(T x)=>x)("LAMBDA")); ! println(apply(<Any T>(T x)=>x, "LAMBDA")); println(apply(nativeToString, "Using native methods as first class values")); println(apply(id(intIdentity), 42)); Index: main.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/main.nice,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** main.nice 12 Sep 2002 15:51:11 -0000 1.29 --- main.nice 20 Feb 2003 11:16:14 -0000 1.30 *************** *** 67,71 **** String s1; ! String->void test = fun(String s2) => { s1 = s2; }; } --- 67,71 ---- String s1; ! String->void test = String s2 => { s1 = s2; }; } *************** *** 76,82 **** int j=2; println("" + j); ! println(""+(fun()=>--j)()); ! println(""+(fun()=>j++)()); ! println(""+(fun()=>j=2*j)()); } --- 76,82 ---- int j=2; println("" + j); ! println(""+(()=>--j)()); ! println(""+(()=>j++)()); ! println(""+(()=>j=2*j)()); } Index: syntax.nice =================================================================== RCS file: /cvsroot/nice/Nice/regtest/basic/syntax.nice,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** syntax.nice 18 Apr 2002 12:39:31 -0000 1.5 --- syntax.nice 20 Feb 2003 11:16:14 -0000 1.6 *************** *** 18,23 **** // Anonymous functions with empty body ! ()->void f = fun()=> {}; ! f = fun()=> { ; }; // [] is the empty array --- 18,23 ---- // Anonymous functions with empty body ! ()->void f = ()=> {}; ! f = ()=> { ; }; // [] is the empty array |
From: <ar...@us...> - 2003-02-20 01:27:59
|
Update of /cvsroot/nice/Nice/src/bossa/syntax In directory sc8-pr-cvs1:/tmp/cvs-serv14046/F:/nice/src/bossa/syntax Modified Files: Pattern.java Log Message: Give an error when #interface patterns are used they make no sense and don't work Index: Pattern.java =================================================================== RCS file: /cvsroot/nice/Nice/src/bossa/syntax/Pattern.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Pattern.java 18 Feb 2003 14:21:20 -0000 1.37 --- Pattern.java 20 Feb 2003 01:27:51 -0000 1.38 *************** *** 116,119 **** --- 116,122 ---- { tc = typeConstructor.resolveToTC(scope); + if (exactlyAt && TypeConstructors.isInterface(tc)) + User.error(typeConstructor.location(), "Pattern #"+typeConstructor.toString()+ + " can never be matched because instances of an interface don't exist."); typeConstructor = null; } |