Allow generalization of annotations with no implementation

This commit is contained in:
Ayaz Hafiz 2023-01-12 14:00:31 -06:00 committed by Folkert
parent beb7e79830
commit d9da945283
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 8 additions and 1 deletions

View file

@ -12,6 +12,7 @@ roc_error_macros = { path = "../../error_macros" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
arrayvec = "0.7.2"

View file

@ -3833,6 +3833,11 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
// Opaque wrapper functions `@Q` are equivalent to closures `\x -> @Q x`, no need to weaken them.
return true;
}
RuntimeError(roc_problem::can::RuntimeError::NoImplementation)
| RuntimeError(roc_problem::can::RuntimeError::NoImplementationNamed { .. }) => {
// Allow generalization of signatures with no implementation
return true;
}
OpaqueRef { argument, .. } => expr = &argument.1.value,
Str(_)
| List { .. }
@ -3853,7 +3858,7 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
| ExpectFx { .. }
| Dbg { .. }
| TypedHole(_)
| RuntimeError(_) => return false,
| RuntimeError(..) => return false,
// TODO(weakening)
Var(_, _) | AbilityMember(_, _, _) | Tag { .. } | ZeroArgumentTag { .. } => {
return true