[ nice-Bugs-923440 ] compiler failure, table2[key] =

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #923440, was opened at 2004-03-25 12:30
Message generated for change (Settings changed) made by igouy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=923440&group_id=12788

Category: None
Group: None
>Status: Deleted
>Resolution: Later
Priority: 5
Submitted By: Isaac Gouy (igouy)
Assigned to: Nobody/Anonymous (nobody)
Summary: compiler failure, table2[key] = 

Initial Comment:
Sorry wasn&#039;t obvious how to make this smaller

Nice compiler version 0.9.8 prerelease (build 2004.03.25, 
17:17:17 UTC)

void main(String[] args){
   var n = 1;
   let nKeys = 10000;

   let table1 = new HashMap(nKeys);
   let table2 = new HashMap();
   for (int i = 0; i <= nKeys; i++) 
      table1["foo_" + i] = new Cell(value: i);

   String key;
   int v1;        
   ?Cell c2;   

   while (n-- > 0) 
     for (each : table1.entrySet) {
         key = each.getKey;
         v1 = each.getValue.value;   
                    
         if ( (c2 = table2[key]) != null)
            c2.value += v1;   
         else 
            table2[key] = new Cell(value: v1); //HERE
      }   
}

class Cell { int value; }
toString(Cell c) = c.value.toString;


//-----------------------------------------------

\Test>nicec --sourcepath .. -a t.jar test
nice.lang: parsing
test: parsing
test: typechecking

An exception has occured in the compiler
Please fill-in a bug report at the following webpage:
http://sourceforge.net/tracker/?
func=add&group_id=12788&atid=112788

Stack trace:
Exception in thread "main" 
java.lang.ArrayIndexOutOfBoundsException: -2
        at mlsub.typing.lowlevel.BitMatrix.get
(BitMatrix.java:128)
        at mlsub.typing.lowlevel.K0.leq0(K0.java:671)
        at mlsub.typing.lowlevel.K0.leq(K0.java:648)
        at mlsub.typing.lowlevel.Engine$Constraint.leq
(Engine.java:926)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:263)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:230)
        at mlsub.typing.Variance.leq(Variance.java:198)
        at mlsub.typing.Variance.leq(Variance.java:190)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:263)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:230)
        at mlsub.typing.NullnessKind.leq
(NullnessKind.java:77)
        at mlsub.typing.NullnessKind.leq
(NullnessKind.java:68)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:263)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:230)
        at mlsub.typing.Variance.assertEq
(Variance.java:251)
        at mlsub.typing.Variance.leq(Variance.java:199)
        at mlsub.typing.Variance.leq(Variance.java:190)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:263)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:230)
        at mlsub.typing.NullnessKind.leq
(NullnessKind.java:77)
        at mlsub.typing.NullnessKind.leq
(NullnessKind.java:68)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:263)
        at mlsub.typing.lowlevel.Engine.leq
(Engine.java:230)
        at mlsub.typing.Typing.leq(Typing.java:355)
        at mlsub.typing.MonotypeLeqCst.enter
(MonotypeLeqCst.java:58)
        at mlsub.typing.Constraint.enter
(Constraint.java:292)
        at mlsub.typing.Constraint.enter
(Constraint.java:281)
        at mlsub.typing.Polytype.simplify
(Polytype.java:264)
        at mlsub.typing.Polytype.trySimplify
(Polytype.java:310)
        at bossa.syntax.CallExp.computeType
(CallExp.java:300)
        at bossa.syntax.Expression.getType
(Expression.java:162)
        at bossa.syntax.fun.typecheck
(typecheck.nice:204)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.typecheck
(typecheck.nice:796)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.typecheck
(typecheck.nice:638)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.typecheck
(typecheck.nice:544)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.typecheck
(typecheck.nice:796)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.lambda12(typecheck.nice:714)
        at bossa.syntax.fun.apply1(typecheck.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at bossa.syntax.fun.typecheck
(typecheck.nice:712)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.lambda12(typecheck.nice:714)
        at bossa.syntax.fun.apply1(typecheck.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at bossa.syntax.fun.typecheck
(typecheck.nice:712)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.typecheck
(typecheck.nice:829)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.lambda12(typecheck.nice:714)
        at bossa.syntax.fun.apply1(typecheck.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at bossa.syntax.fun.typecheck
(typecheck.nice:712)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.typecheck
(typecheck.nice:829)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.lambda12(typecheck.nice:714)
        at bossa.syntax.fun.apply1(typecheck.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at bossa.syntax.fun.typecheck
(typecheck.nice:712)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.lambda12(typecheck.nice:714)
        at bossa.syntax.fun.apply1(typecheck.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at bossa.syntax.fun.typecheck
(typecheck.nice:712)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at bossa.syntax.fun.lambda12(typecheck.nice:714)
        at bossa.syntax.fun.apply1(typecheck.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at bossa.syntax.fun.typecheck
(typecheck.nice:712)
        at bossa.syntax.dispatch.typecheck(dispatch.nice)
        at 
bossa.syntax.DefaultMethodImplementation.innerTypeche
ck(DefaultMethodImplementation.java:95)
        at 
bossa.syntax.NiceMethod$WithDefault.innerTypecheck
(NiceMethod.java:352)
        at bossa.syntax.MethodDeclaration.typecheck
(MethodDeclaration.java:205)
        at bossa.syntax.Node.doTypecheck
(Node.java:303)
        at bossa.syntax.Node.doTypecheck
(Node.java:308)
        at bossa.syntax.Node.doTypecheck
(Node.java:308)
        at bossa.syntax.AST.typechecking(AST.java:188)
        at bossa.modules.Package.typecheck
(Package.java:323)
        at mlsub.compilation.fun.lambda18(make.nice:29)
        at mlsub.compilation.fun.apply1(make.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at mlsub.compilation.fun.compileComponent
(make.nice:29)
        at mlsub.compilation.dispatch.compileComponent
(dispatch.nice)
        at mlsub.compilation.fun$make.lambda17
(make.nice:45)
        at mlsub.compilation.fun$make.apply1(make.nice:0)
        at gnu.expr.ModuleMethod.apply1
(ModuleMethod.java:89)
        at nice.lang.fun.foreach(collections.nice:121)
        at nice.lang.dispatch.foreach(range.nice:0)
        at mlsub.compilation.fun.make(make.nice:44)
        at mlsub.compilation.dispatch.make(dispatch.nice)
        at nice.tools.compiler.fun.compile
(interface.nice:40)
        at bossa.modules.Compilation.compile
(Compilation.nice)
        at nice.tools.compiler.console.fun.compile
(main.nice:168)
        at nice.tools.compiler.console.dispatch.compile
(dispatch.nice)
        at nice.tools.compiler.console.fun.main
(main.nice:184)





----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=923440&group_id=12788


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.