This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: Error on seeing (a . b) can perplex
- From: Per Bothner <per at bothner dot com>
- To: Jocelyn Paine <popx at ifs dot org dot uk>
- Cc: kawa at sources dot redhat dot com
- Date: Sun, 14 Jul 2002 17:45:40 -0700
- Subject: Re: Error on seeing (a . b) can perplex
- References: <Pine.LNX.4.21.0207140538460.13419-100000@pop3.ifs.org.uk>
Jocelyn Paine wrote:
While I was trying to compile a program this morning, the compiler kept
throwing
java.lang.NegativeArraySizeException
at kawa.lang.Translator.rewrite_pair(Compiled Code)
at kawa.lang.Translator.rewrite_with_position(Translator.java:507)
at kawa.lang.Translator.rewrite(Translator.java:350)
I discovered eventually - looking for anything to do with pairs in my code
- that this was due to an "insufficient quoting" error that I perpetrate
too often, namely writing a pair as (a . b) instead of '(,a . ,b) or (cons
a b).
I already fixed this, but haven't checked this in yet.
Please try this patch. Any suggestions for better wording
of the error message?
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
Index: Translator.java
===================================================================
RCS file: /cvs/kawa/kawa/kawa/lang/Translator.java,v
retrieving revision 1.62
diff -u -r1.62 Translator.java
--- Translator.java 10 Jun 2002 21:53:50 -0000 1.62
+++ Translator.java 15 Jul 2002 00:36:37 -0000
@@ -321,6 +334,9 @@
}
}
+ if (cdr_length < 0)
+ return syntaxError("dotted list is not allowed");
+
Expression[] args = new Expression[cdr_length];
for (int i = 0; i < cdr_length; i++)