dplassgit/d2lang

Runtime exception for index out of range

Closed this issue · 0 comments

Source:

a="hello"
println a[5]

Produces this error:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 5
        at java.lang.String.charAt(String.java:658)
        at com.plasstech.lang.d2.optimize.ArithmeticOptimizer.visit(ArithmeticOptimizer.java:273)
        at com.plasstech.lang.d2.codegen.il.BinOp.accept(BinOp.java:47)
        at com.plasstech.lang.d2.optimize.LineOptimizer.optimize(LineOptimizer.java:56)
        at com.plasstech.lang.d2.optimize.ILOptimizer.optimize(ILOptimizer.java:77)
        at com.plasstech.lang.d2.optimize.ILOptimizer.execute(ILOptimizer.java:58)
        at com.plasstech.lang.d2.D2Compiler.main(D2Compiler.java:77)