Skip to content

Commit 7652f7e

Browse files
committed
print recur mismatch warnings, for now
1 parent c79d287 commit 7652f7e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/jvm/clojure/lang/Compiler.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5488,10 +5488,15 @@ public boolean canEmitPrimitive(){
54885488
public static class RecurExpr implements Expr{
54895489
public final IPersistentVector args;
54905490
public final IPersistentVector loopLocals;
5491+
final int line;
5492+
final String source;
5493+
54915494

5492-
public RecurExpr(IPersistentVector loopLocals, IPersistentVector args){
5495+
public RecurExpr(IPersistentVector loopLocals, IPersistentVector args, int line, String source){
54935496
this.loopLocals = loopLocals;
54945497
this.args = args;
5498+
this.line = line;
5499+
this.source = source;
54955500
}
54965501

54975502
public Object eval() throws Exception{
@@ -5536,11 +5541,12 @@ else if(primc == float.class && pc == double.class)
55365541
}
55375542
else
55385543
{
5539-
if(RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
5544+
if(true)//RT.booleanCast(RT.WARN_ON_REFLECTION.deref()))
55405545
//throw new IllegalArgumentException
55415546
RT.errPrintWriter().println
5542-
("recur arg for primitive local: " +
5543-
lb.name + " must be matching primitive, had: " +
5547+
(source + ":" + line +
5548+
" recur arg for primitive local: " +
5549+
lb.name + " is not matching primitive, had: " +
55445550
(arg.hasJavaClass() ? arg.getJavaClass().getName():"Object") +
55455551
", needed: " +
55465552
primc.getName());
@@ -5587,6 +5593,9 @@ public Class getJavaClass() throws Exception{
55875593

55885594
static class Parser implements IParser{
55895595
public Expr parse(C context, Object frm) throws Exception{
5596+
int line = (Integer) LINE.deref();
5597+
String source = (String) SOURCE.deref();
5598+
55905599
ISeq form = (ISeq) frm;
55915600
IPersistentVector loopLocals = (IPersistentVector) LOOP_LOCALS.deref();
55925601
if(context != C.RETURN || loopLocals == null)
@@ -5602,7 +5611,7 @@ public Expr parse(C context, Object frm) throws Exception{
56025611
throw new IllegalArgumentException(
56035612
String.format("Mismatched argument count to recur, expected: %d args, got: %d",
56045613
loopLocals.count(), args.count()));
5605-
return new RecurExpr(loopLocals, args);
5614+
return new RecurExpr(loopLocals, args, line, source);
56065615
}
56075616
}
56085617
}

0 commit comments

Comments
 (0)