Browse Source

change the type of error for type decl syntax

pull/12/head
nisstyre56 11 years ago
parent
commit
c6ad6e2b17
  1. 2
      desugar.js
  2. 2
      example.jl
  3. 8
      representation.js

2
desugar.js

@ -52,6 +52,8 @@ function sugarTypeApp(stx) {
var expression; var expression;
type = stx.p; type = stx.p;
expression = desugar(stx.func.p); expression = desugar(stx.func.p);
expression.linenum = stx.linenum;
expression.charnum = stx.charnum;
return new typ.TypeApp(expression, type); return new typ.TypeApp(expression, type);
} }

2
example.jl

@ -1,7 +1,7 @@
defop 2 Left (a ++ b) defop 2 Left (a ++ b)
(a - b) (a - b)
(qat :: A -> B) (qat :: A -> b)
def qat (lambda a b c -> (a + b)) def qat (lambda a b c -> (a + b))
def (add a b) def (add a b)

8
representation.js

@ -24,7 +24,9 @@ var TypeExpression = {
console.log("Could not unify " + this.expr + " with " + t.expr); console.log("Could not unify " + this.expr + " with " + t.expr);
} }
}, },
isTypeExpr : true isTypeExpr : true,
linenum : 0,
charnum : 0
}; };
function isTypeExpr(x) { function isTypeExpr(x) {
@ -270,7 +272,9 @@ function isTypeExpr(expr) {
function TypeApp(expression, type) { function TypeApp(expression, type) {
if (isTypeExprRec(expression) && if (isTypeExprRec(expression) &&
expression.exprType !== "Name") { 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" "Left-hand-side of type application must not be in the type language"
); );
} }

Loading…
Cancel
Save