Browse Source

fix false positive when checking lhs of type declarations for being type decls themselves

pull/12/head
nisstyre56 11 years ago
parent
commit
2ddb05930c
  1. 4
      example.jl
  2. 7
      representation.js

4
example.jl

@ -1,12 +1,14 @@
defop 2 Left (a ++ b) defop 2 Left (a ++ b)
(a - b) (a - b)
(qat :: (T -> B -> "wat")) (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)
(a + b) (a + b)
def wat [[1,2,3], [4,5,6]]
def (catstrs strs) def (catstrs strs)
(foldr f (foldr f
(head strs) (head strs)

7
representation.js

@ -62,9 +62,9 @@ function flattenTypeApp(stx) {
}; };
} }
function isTypeExprRec(stx) { function isTypeExprRec(stx) {
var flattened = flattenTypeApp(stx); var flattened = flattenTypeApp(stx);
console.log(flattened);
for(var i = 0; i < flattened.length; i++) { for(var i = 0; i < flattened.length; i++) {
if (flattened[i].failed !== undefined && if (flattened[i].failed !== undefined &&
flattened[i].failed) { flattened[i].failed) {
@ -74,8 +74,6 @@ function isTypeExprRec(stx) {
return true; return true;
} }
function App(func, p) { function App(func, p) {
this.func = func; this.func = func;
this.exprType = "Application"; this.exprType = "Application";
@ -270,7 +268,8 @@ function isTypeExpr(expr) {
} }
function TypeApp(expression, type) { function TypeApp(expression, type) {
if (isTypeExprRec(expression)) { if (isTypeExprRec(expression) &&
expression.exprType !== "Name") {
throw errors.JInternalError( throw errors.JInternalError(
"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