You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bad field gives ArrayIndexOutOfBoundsException. For example,
let val e1 = {name="Fred",empno=10} in #ename e1 end;
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 2
at java.base/java.util.Arrays$ArrayList.get(Arrays.java:4351)
at net.hydromatic.morel.eval.Codes.lambda$nth$23(Codes.java:335)
at net.hydromatic.morel.eval.Codes.lambda$apply$20(Codes.java:206)
at net.hydromatic.morel.eval.Codes.lambda$let$17(Codes.java:177)
at net.hydromatic.morel.compile.Compiler.lambda$compileValBind$8(Compiler.java:512)
at net.hydromatic.morel.compile.Compiler$1.eval(Compiler.java:76)
at net.hydromatic.morel.Shell.run(Shell.java:250)
at net.hydromatic.morel.Shell.main(Shell.java:75)
It should give a better error message.
Here's what sml does in a similar situation:
- let val e1 = {name="Fred",empno=10} in #name e1 end;
val it = "Fred" : string
- let val e1 = {name="Fred",empno=10} in #ename e1 end;
stdIn:2.40-2.49 Error: operator and operand don't agree [record labels]
operator domain: {ename:'Y; 'Z}
operand: {empno:[int ty], name:string}
in expression:
(fn {ename=ename,...} => ename) e1
The problem also occurs in from expressions:
from e in [{empno=10, name="Fred"}] yield {no = #empno e, name = #ename e};
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 2
at java.base/java.util.Arrays$ArrayList.get(Arrays.java:4351)
at net.hydromatic.morel.eval.Codes.lambda$nth$23(Codes.java:335)
at net.hydromatic.morel.eval.Codes.lambda$apply$20(Codes.java:206)
at net.hydromatic.morel.eval.Codes$TupleCode.eval(Codes.java:891)
at net.hydromatic.morel.eval.Codes$2.loop(Codes.java:246)
at net.hydromatic.morel.eval.Codes$2.loop(Codes.java:253)
at net.hydromatic.morel.eval.Codes$2.eval(Codes.java:236)
at net.hydromatic.morel.compile.Compiler.lambda$compileValBind$8(Compiler.java:512)
at net.hydromatic.morel.compile.Compiler$1.eval(Compiler.java:76)
at net.hydromatic.morel.Shell.run(Shell.java:250)
at net.hydromatic.morel.Shell.main(Shell.java:75)
The text was updated successfully, but these errors were encountered:
Bad field gives ArrayIndexOutOfBoundsException. For example,
It should give a better error message.
Here's what sml does in a similar situation:
The problem also occurs in
from
expressions:The text was updated successfully, but these errors were encountered: