From c6ad6e2b17c782e1a4947fb0a68ae8364d6df0b7 Mon Sep 17 00:00:00 2001 From: nisstyre56 Date: Sat, 17 May 2014 00:22:44 -0400 Subject: [PATCH] change the type of error for type decl syntax --- desugar.js | 2 ++ example.jl | 2 +- representation.js | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/desugar.js b/desugar.js index d0a2aa0..6489e6b 100644 --- a/desugar.js +++ b/desugar.js @@ -52,6 +52,8 @@ function sugarTypeApp(stx) { var expression; type = stx.p; expression = desugar(stx.func.p); + expression.linenum = stx.linenum; + expression.charnum = stx.charnum; return new typ.TypeApp(expression, type); } diff --git a/example.jl b/example.jl index f16bca0..7d6d07a 100644 --- a/example.jl +++ b/example.jl @@ -1,7 +1,7 @@ defop 2 Left (a ++ b) (a - b) -(qat :: A -> B) +(qat :: A -> b) def qat (lambda a b c -> (a + b)) def (add a b) diff --git a/representation.js b/representation.js index 1f51aeb..da1d72f 100644 --- a/representation.js +++ b/representation.js @@ -24,7 +24,9 @@ var TypeExpression = { console.log("Could not unify " + this.expr + " with " + t.expr); } }, - isTypeExpr : true + isTypeExpr : true, + linenum : 0, + charnum : 0 }; function isTypeExpr(x) { @@ -270,7 +272,9 @@ function isTypeExpr(expr) { function TypeApp(expression, type) { if (isTypeExprRec(expression) && expression.exprType !== "Name") { - throw errors.JInternalError( + throw errors.JSyntaxError( + expression.linenum, + expression.charnum, "Left-hand-side of type application must not be in the type language" ); }