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" ); }