use default
This commit is contained in:
parent
9d72188f48
commit
6b93bf0fc6
@ -94,8 +94,10 @@ class Expr {
|
||||
return k.value;
|
||||
case "Add":
|
||||
return k.right.eval() + k.left.eval();
|
||||
}
|
||||
default:
|
||||
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;
|
||||
switch (k.tag) {
|
||||
case "Int":
|
||||
return;
|
||||
break;
|
||||
case "Add":
|
||||
k.left.visit(v);
|
||||
k.right.visit(v);
|
||||
return
|
||||
}
|
||||
break;
|
||||
default:
|
||||
k satisfies never;
|
||||
}
|
||||
}
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
@ -157,9 +157,10 @@ class Val {
|
||||
return `${k.value}`;
|
||||
case "Fn":
|
||||
return `<${k.fn.ty.pretty()}>`;
|
||||
}
|
||||
default:
|
||||
k satisfies never;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type ValKind =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user