use default
This commit is contained in:
parent
9d72188f48
commit
6b93bf0fc6
@ -94,8 +94,10 @@ class Expr {
|
|||||||
return k.value;
|
return k.value;
|
||||||
case "Add":
|
case "Add":
|
||||||
return k.right.eval() + k.left.eval();
|
return k.right.eval() + k.left.eval();
|
||||||
}
|
default:
|
||||||
k satisfies never; // compile time exhaustiveness check
|
k satisfies never; // compile time exhaustiveness check
|
||||||
|
throw new Error("unexhausted"): // run time exhaustiveness check
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
@ -195,14 +197,15 @@ class Expr {
|
|||||||
const k = this.kind;
|
const k = this.kind;
|
||||||
switch (k.tag) {
|
switch (k.tag) {
|
||||||
case "Int":
|
case "Int":
|
||||||
return;
|
break;
|
||||||
case "Add":
|
case "Add":
|
||||||
k.left.visit(v);
|
k.left.visit(v);
|
||||||
k.right.visit(v);
|
k.right.visit(v);
|
||||||
return
|
break;
|
||||||
}
|
default:
|
||||||
k satisfies never;
|
k satisfies never;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -157,10 +157,11 @@ class Val {
|
|||||||
return `${k.value}`;
|
return `${k.value}`;
|
||||||
case "Fn":
|
case "Fn":
|
||||||
return `<${k.fn.ty.pretty()}>`;
|
return `<${k.fn.ty.pretty()}>`;
|
||||||
}
|
default:
|
||||||
k satisfies never;
|
k satisfies never;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type ValKind =
|
type ValKind =
|
||||||
| { tag: "Void" }
|
| { tag: "Void" }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user