Menu

#178 Nicec crash with somewhat complex inferred generic type

open
nobody
None
5
2014-08-23
2006-06-27
B S
No

This code will crash nicec-0.9.12:
package bug;
void main(String[] args){
let map = new HashMap(); //Map<char[],Set<String>>
let char[] c =new char[0];
map.put(c,new HashSet()); //or new HashSet([""])

for(a:map.values){ }
}

Output:
nice.lang: parsing
bug: parsing
bug: 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:146)
at mlsub.typing.lowlevel.K0.leq0(K0.java:676)
at mlsub.typing.lowlevel.K0.leq(K0.java:653)
at
mlsub.typing.lowlevel.Engine$Constraint.leq(Engine.java:983)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:265)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:232)
at
mlsub.typing.NullnessKind.leq(NullnessKind.java:112)
at
mlsub.typing.NullnessKind.leq(NullnessKind.java:89)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:265)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:232)
at
mlsub.typing.Variance.assertEq(Variance.java:262)
at mlsub.typing.Variance.leq(Variance.java:199)
at mlsub.typing.Variance.leq(Variance.java:190)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:300)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:232)
at
mlsub.typing.NullnessKind.leq(NullnessKind.java:113)
at
mlsub.typing.NullnessKind.leq(NullnessKind.java:89)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:265)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:232)
at
mlsub.typing.Variance.assertEq(Variance.java:262)
at mlsub.typing.Variance.leq(Variance.java:199)
at mlsub.typing.Variance.leq(Variance.java:190)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:265)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:232)
at
mlsub.typing.NullnessKind.leq(NullnessKind.java:113)
at
mlsub.typing.NullnessKind.leq(NullnessKind.java:89)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:265)
at
mlsub.typing.lowlevel.Engine.leq(Engine.java:232)
at mlsub.typing.Typing.leq(Typing.java:355)
at mlsub.typing.Typing.in(Typing.java:521)
at mlsub.typing.Typing.in(Typing.java:541)
at bossa.syntax.fun.getType(block.nice:151)
at bossa.syntax.dispatch.getType(Unknown Source)
at bossa.syntax.fun.wellTyped(call.nice:274)
at bossa.syntax.dispatch.wellTyped(Unknown Source)
at
bossa.syntax.fun.resolveOverloading(overloadedsymbol.nice:133)
at
bossa.syntax.dispatch.resolveOverloading(Unknown Source)
at
bossa.syntax.fun.resolveOverloading(call.nice:54)
at
bossa.syntax.CallExp.resolveOverloading(call.nice)
at bossa.syntax.fun.computeType(call.nice:69)
at bossa.syntax.CallExp.computeType(call.nice)
at
bossa.syntax.Expression.getType(Expression.java:109)
at bossa.syntax.fun.typecheck(typecheck.nice:242)
at bossa.syntax.dispatch.typecheck(Unknown Source)
at bossa.syntax.fun.typecheck(typecheck.nice:829)
at bossa.syntax.dispatch.typecheck(Unknown Source)
at bossa.syntax.fun.lambda28(Unknown Source)
at bossa.syntax.fun.apply1(Unknown Source)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:141)
at nice.lang.dispatch.foreach(Unknown Source)
at bossa.syntax.fun.typecheck(typecheck.nice:802)
at bossa.syntax.dispatch.typecheck(Unknown Source)
at bossa.syntax.fun.lambda29(typecheck.nice:805)
at bossa.syntax.fun.apply1(Unknown Source)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:141)
at nice.lang.dispatch.foreach(Unknown Source)
at bossa.syntax.fun.typecheck(typecheck.nice:803)
at bossa.syntax.dispatch.typecheck(Unknown Source)
at
bossa.syntax.fun.innerTypecheck(defaultMethod.nice:100)
at
bossa.syntax.DefaultMethodImplementation.innerTypecheck(defaultMethod.nice)
at
bossa.syntax.fun.innerTypecheck(defaultMethod.nice:28)
at
bossa.syntax.MethodDeclaration.innerTypecheck(methodDeclaration.nice)
at
bossa.syntax.fun.typecheck(methodDeclaration.nice:161)
at
bossa.syntax.MethodDeclaration.typecheck(methodDeclaration.nice)
at bossa.syntax.Node.doTypecheck(Node.java:299)
at bossa.syntax.Node.doTypecheck(Node.java:304)
at bossa.syntax.Node.doTypecheck(Node.java:304)
at bossa.syntax.fun.typechecking(ast.nice:146)
at bossa.syntax.CAST.typechecking(ast.nice)
at
bossa.modules.Package.typecheck(Package.java:369)
at mlsub.compilation.fun.lambda25(Unknown Source)
at mlsub.compilation.fun.apply1(Unknown Source)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:141)
at nice.lang.dispatch.foreach(Unknown Source)
at
mlsub.compilation.fun.compileComponent(make.nice:29)
at
mlsub.compilation.dispatch.compileComponent(Unknown Source)
at mlsub.compilation.fun$make.lambda24(Unknown
Source)
at mlsub.compilation.fun$make.apply1(Unknown
Source)
at
gnu.expr.ModuleMethod.apply1(ModuleMethod.java:89)
at nice.lang.fun.foreach(collections.nice:141)
at nice.lang.dispatch.foreach(Unknown Source)
at mlsub.compilation.fun.make(make.nice:44)
at mlsub.compilation.dispatch.make(Unknown Source)
at
nice.tools.compiler.fun.compile(interface.nice:40)
at nice.tools.compiler.dispatch.compile(Unknown
Source)
at
nice.tools.compiler.console.fun.compile(main.nice:170)
at
nice.tools.compiler.console.dispatch.compile(Unknown
Source)
at
nice.tools.compiler.console.fun.main(main.nice:204)
at
nice.tools.compiler.console.dispatch.main(Unknown Source)

Adding the type declaration to map given in the comment
prevents the crash.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB