Prevent non-default fallback on exhaustive validator
Technically, we always need a fallback just because the way the UPLC is going to work. The last case in the handler pattern matching is always going to be else ... We could optimize that away and when the validator is exhaustive, make the last handler the fallback. Yet, it's really a micro optimization that saves us one extra if/else. So the sake of getting things working, we always assume that there's a fallback but, with the extra condition that when the validator is exhaustive (i.e. there's a handler covering all purposes), the fallback HAS TO BE the default fallback (i.e. (_) => fail). This allows us to gracefully format it out, and also raise an error in case where there's an extraneous custom fallback.
This commit is contained in:
@@ -256,8 +256,7 @@ impl Type {
|
||||
pub fn list(t: Rc<Type>) -> Rc<Type> {
|
||||
Rc::new(Type::App {
|
||||
public: true,
|
||||
// FIXME: We should probably have t.contains_opaque here?
|
||||
contains_opaque: false,
|
||||
contains_opaque: t.contains_opaque(),
|
||||
name: LIST.to_string(),
|
||||
module: "".to_string(),
|
||||
args: vec![t],
|
||||
@@ -290,8 +289,7 @@ impl Type {
|
||||
pub fn option(a: Rc<Type>) -> Rc<Type> {
|
||||
Rc::new(Type::App {
|
||||
public: true,
|
||||
// FIXME: We should probably have t.contains_opaque here?
|
||||
contains_opaque: false,
|
||||
contains_opaque: a.contains_opaque(),
|
||||
name: OPTION.to_string(),
|
||||
module: "".to_string(),
|
||||
args: vec![a],
|
||||
|
||||
Reference in New Issue
Block a user