This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error on seeing (a . b) can perplex


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++)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]