@@ -1,14 +1,13 @@ @@type = fun(x){ if _isint(x): "int" else if _isstr(x): "str" - else if _isundefined(x): "undefined" else: "any" }; def binop(a,b,c) { fun(x,y){@value( - if( @type(x)=="undefined" || @type(y)=="undefined" ) then "undefined" else + if( _isbot( @type(x) ) || _isbot( @type(y) ) ) then @type(...) else if( @type(x)==a && @type(y)==b ) then c else "error" )} }; @@ -17,9 +16,9 @@ @type "<" = binop("int", "int", "int"); @type ">" = binop("int", "int", "int"); def mergeType(a,b) { - if( a == "undefined" ): ( if(b=="undefined"):"error" else b ) else ( a ) + if( _isbot(a) ): ( if( _isbot(b) ):"error" else b ) else ( a ) }; @type "if" = fun(c,t,e) {@value( if(@type(c)=="int" ): mergeType(@type(t()), @type(e())) else : "error"