Commit 712ac8f8 authored by Giuseppe Castagna's avatar Giuseppe Castagna
Browse files

updated typescript

parent 42be51d6
......@@ -10,6 +10,7 @@ type ENode = EDocument | EElement | EText;
function isEmpty3 (x : EDocument) : true;
function isEmpty3 (x : { kind : 2; children : ENil }) : true;
function isEmpty3 (x : { kind : 2; children : { node : ENode; next : EList } }) : false;
/* without this case the last application fails to type-check */
function isEmpty3 (x : EElement) : boolean;
function isEmpty3 (x : EText) : boolean;
function isEmpty3 (x : ENode) : boolean {
......@@ -19,10 +20,20 @@ function isEmpty3 (x : ENode) : boolean {
return true;
} else if (x.kind == 2) {
return false;
} else if (x.kind == 9) {
} else {
return x.isEmpty();
}
}
isEmpty3({ kind : 2, children : ENil.NIL });
function foo ():EList {
if (Math.random()< .5){
return ENil.NIL
} else {
return {node: {kind : 1}, next: ENil.NIL }
}
}
isEmpty3({ kind : 2, children : foo() });
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment