[ nice-Bugs-988319 ] Polymorphic type inference: HashMap
"SourceForge.net" <[email protected]> Wed, 14 Jul 2004 01:39:01 -0700
| Newsgroups | gmane.comp.lang.nice.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #988319, was opened at 2004-07-10 03:05
Message generated for change (Comment added) made by bonniot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=988319&group_id=12788
Category: None
Group: None
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Isaac Gouy (igouy)
>Assigned to: Daniel Bonniot (bonniot)
>Summary: Polymorphic type inference: HashMap
Initial Comment:
Nice compiler version 0.9.8 (build 2004.07.02, 18:42:24
UTC)
void main(String[] args){
let b = new HashMap();
b[2222] = new HashMap();
b[4444] = new HashMap();
}
I:\pls\Nice\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 java.util.Vector.get(Vector.java:711)
at
mlsub.typing.lowlevel.Engine$Constraint.getElement(Engine.java:832)
at
mlsub.typing.lowlevel.Engine.canonify(Engine.java:442)
at
mlsub.typing.MonotypeConstructor.canonify(MonotypeConstructor.java:170)
at
mlsub.typing.Monotype.canonify(Monotype.java:153)
at
mlsub.typing.MonotypeConstructor.canonify(MonotypeConstructor.java:172)
at
mlsub.typing.Monotype.canonify(Monotype.java:153)
at
mlsub.typing.MonotypeConstructor.canonify(MonotypeConstructor.java:172)
at
mlsub.typing.MonotypeVar.canonify(MonotypeVar.java:266)
at
mlsub.typing.Monotype.canonify(Monotype.java:153)
at
mlsub.typing.TupleType.canonify(TupleType.java:93)
at
mlsub.typing.Polytype.simplify(Polytype.java:302)
at
bossa.syntax.CallExp.setComputedType(CallExp.java:307)
at
bossa.syntax.OverloadedSymbolExp.resolveOverloading(OverloadedSymbolExp.java:206)
at
bossa.syntax.CallExp.resolveOverloading(CallExp.java:259)
at
bossa.syntax.CallExp.computeType(CallExp.java:273)
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.lambda13(typecheck.nice:714)
at bossa.syntax.fun.apply1(fun.nice)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:134)
at nice.lang.dispatch.foreach(dispatch.nice)
at bossa.syntax.fun.typecheck(typecheck.nice:712)
at bossa.syntax.dispatch.typecheck(dispatch.nice)
at bossa.syntax.fun.lambda13(typecheck.nice:714)
at bossa.syntax.fun.apply1(fun.nice)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:134)
at nice.lang.dispatch.foreach(dispatch.nice)
at bossa.syntax.fun.typecheck(typecheck.nice:712)
at bossa.syntax.dispatch.typecheck(dispatch.nice)
at
bossa.syntax.DefaultMethodImplementation.innerTypecheck(DefaultMethodImplementation.java:95)
at
bossa.syntax.NiceMethod$WithDefault.innerTypecheck(NiceMethod.java:367)
at
bossa.syntax.MethodDeclaration.typecheck(MethodDeclaration.java:229)
at bossa.syntax.Node.doTypecheck(Node.java:297)
at bossa.syntax.Node.doTypecheck(Node.java:302)
at bossa.syntax.Node.doTypecheck(Node.java:302)
at bossa.syntax.AST.typechecking(AST.java:188)
at
bossa.modules.Package.typecheck(Package.java:323)
at mlsub.compilation.fun.lambda19(make.nice:29)
at mlsub.compilation.fun.apply1(fun.nice)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:134)
at nice.lang.dispatch.foreach(dispatch.nice)
at
mlsub.compilation.fun.compileComponent(make.nice:29)
at
mlsub.compilation.dispatch.compileComponent(dispatch.nice)
at
mlsub.compilation.fun$make.lambda18(make.nice:45)
at mlsub.compilation.fun$make.apply1(fun.nice)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:134)
at nice.lang.dispatch.foreach(dispatch.nice)
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:169)
at
nice.tools.compiler.console.dispatch.compile(dispatch.nice)
at
nice.tools.compiler.console.fun.main(main.nice:185)
----------------------------------------------------------------------
>Comment By: Daniel Bonniot (bonniot)
Date: 2004-07-14 10:39
Message:
Logged In: YES
user_id=88952
OK, this is a case of polymorphic type inference that does
not work yet. In such a situation, simply specify the type
of the variable, for instance:
let Map<int,Map<int,int>> b = new HashMap();
...
It's still a good idea to report the bug, so that we fix it
and add it to the list of testcases.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=988319&group_id=12788
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com