mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
has -> implements in roc_problem::can::Problem
This commit is contained in:
parent
e04f09231c
commit
17c733ec81
4 changed files with 25 additions and 25 deletions
|
@ -1041,7 +1041,7 @@ fn can_annotation_help(
|
|||
debug_assert!(!clauses.is_empty());
|
||||
|
||||
// Has clauses are allowed only on the top level of a signature, which we handle elsewhere.
|
||||
env.problem(roc_problem::can::Problem::IllegalHasClause {
|
||||
env.problem(roc_problem::can::Problem::IllegalImplementsClause {
|
||||
region: Region::across_all(clauses.iter().map(|clause| &clause.region)),
|
||||
});
|
||||
|
||||
|
@ -1096,13 +1096,13 @@ fn canonicalize_has_clause(
|
|||
// or an ability that was imported from elsewhere
|
||||
&& !scope.abilities_store.is_ability(symbol)
|
||||
{
|
||||
env.problem(roc_problem::can::Problem::HasClauseIsNotAbility { region });
|
||||
env.problem(roc_problem::can::Problem::ImplementsClauseIsNotAbility { region });
|
||||
return Err(Type::Error);
|
||||
}
|
||||
symbol
|
||||
}
|
||||
_ => {
|
||||
env.problem(roc_problem::can::Problem::HasClauseIsNotAbility { region });
|
||||
env.problem(roc_problem::can::Problem::ImplementsClauseIsNotAbility { region });
|
||||
return Err(Type::Error);
|
||||
}
|
||||
};
|
||||
|
@ -1111,7 +1111,7 @@ fn canonicalize_has_clause(
|
|||
let already_seen = can_abilities.insert(ability);
|
||||
|
||||
if already_seen {
|
||||
env.problem(roc_problem::can::Problem::DuplicateHasAbility { ability, region });
|
||||
env.problem(roc_problem::can::Problem::DuplicateImplementsAbility { ability, region });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1388,7 +1388,7 @@ fn resolve_abilities(
|
|||
[] => {
|
||||
// There are no variables bound to the parent ability - then this member doesn't
|
||||
// need to be a part of the ability.
|
||||
env.problem(Problem::AbilityMemberMissingHasClause {
|
||||
env.problem(Problem::AbilityMemberMissingImplementsClause {
|
||||
member: member_sym,
|
||||
ability,
|
||||
region: member_name_region,
|
||||
|
@ -1411,7 +1411,7 @@ fn resolve_abilities(
|
|||
env.problem(Problem::AbilityMemberMultipleBoundVars {
|
||||
member: member_sym,
|
||||
ability,
|
||||
span_has_clauses,
|
||||
span_implements_clauses: span_has_clauses,
|
||||
bound_var_names,
|
||||
});
|
||||
// Pretend the member isn't a part of the ability
|
||||
|
|
|
@ -117,17 +117,17 @@ pub enum Problem {
|
|||
name: Symbol,
|
||||
variables_region: Region,
|
||||
},
|
||||
HasClauseIsNotAbility {
|
||||
ImplementsClauseIsNotAbility {
|
||||
region: Region,
|
||||
},
|
||||
IllegalHasClause {
|
||||
IllegalImplementsClause {
|
||||
region: Region,
|
||||
},
|
||||
DuplicateHasAbility {
|
||||
DuplicateImplementsAbility {
|
||||
ability: Symbol,
|
||||
region: Region,
|
||||
},
|
||||
AbilityMemberMissingHasClause {
|
||||
AbilityMemberMissingImplementsClause {
|
||||
member: Symbol,
|
||||
ability: Symbol,
|
||||
region: Region,
|
||||
|
@ -135,7 +135,7 @@ pub enum Problem {
|
|||
AbilityMemberMultipleBoundVars {
|
||||
member: Symbol,
|
||||
ability: Symbol,
|
||||
span_has_clauses: Region,
|
||||
span_implements_clauses: Region,
|
||||
bound_var_names: Vec<Lowercase>,
|
||||
},
|
||||
AbilityNotOnToplevel {
|
||||
|
@ -245,10 +245,10 @@ impl Problem {
|
|||
Problem::NestedDatatype { .. } => RuntimeError,
|
||||
Problem::InvalidExtensionType { .. } => RuntimeError,
|
||||
Problem::AbilityHasTypeVariables { .. } => RuntimeError,
|
||||
Problem::HasClauseIsNotAbility { .. } => RuntimeError,
|
||||
Problem::IllegalHasClause { .. } => RuntimeError,
|
||||
Problem::DuplicateHasAbility { .. } => Warning,
|
||||
Problem::AbilityMemberMissingHasClause { .. } => RuntimeError,
|
||||
Problem::ImplementsClauseIsNotAbility { .. } => RuntimeError,
|
||||
Problem::IllegalImplementsClause { .. } => RuntimeError,
|
||||
Problem::DuplicateImplementsAbility { .. } => Warning,
|
||||
Problem::AbilityMemberMissingImplementsClause { .. } => RuntimeError,
|
||||
Problem::AbilityMemberMultipleBoundVars { .. } => RuntimeError,
|
||||
Problem::AbilityNotOnToplevel { .. } => RuntimeError, // Ideally, could be compiled
|
||||
Problem::AbilityUsedAsType(_, _, _) => RuntimeError,
|
||||
|
@ -375,12 +375,12 @@ impl Problem {
|
|||
variables_region: region,
|
||||
..
|
||||
}
|
||||
| Problem::HasClauseIsNotAbility { region }
|
||||
| Problem::IllegalHasClause { region }
|
||||
| Problem::DuplicateHasAbility { region, .. }
|
||||
| Problem::AbilityMemberMissingHasClause { region, .. }
|
||||
| Problem::ImplementsClauseIsNotAbility { region }
|
||||
| Problem::IllegalImplementsClause { region }
|
||||
| Problem::DuplicateImplementsAbility { region, .. }
|
||||
| Problem::AbilityMemberMissingImplementsClause { region, .. }
|
||||
| Problem::AbilityMemberMultipleBoundVars {
|
||||
span_has_clauses: region,
|
||||
span_implements_clauses: region,
|
||||
..
|
||||
}
|
||||
| Problem::AbilityNotOnToplevel { region }
|
||||
|
|
|
@ -648,7 +648,7 @@ pub fn can_problem<'b>(
|
|||
title = ABILITY_HAS_TYPE_VARIABLES.to_string();
|
||||
}
|
||||
|
||||
Problem::HasClauseIsNotAbility {
|
||||
Problem::ImplementsClauseIsNotAbility {
|
||||
region: clause_region,
|
||||
} => {
|
||||
doc = alloc.stack([
|
||||
|
@ -660,7 +660,7 @@ pub fn can_problem<'b>(
|
|||
title = IMPLEMENTS_CLAUSE_IS_NOT_AN_ABILITY.to_string();
|
||||
}
|
||||
|
||||
Problem::IllegalHasClause { region } => {
|
||||
Problem::IllegalImplementsClause { region } => {
|
||||
doc = alloc.stack([
|
||||
alloc.concat([
|
||||
alloc.reflow("An "),
|
||||
|
@ -678,7 +678,7 @@ pub fn can_problem<'b>(
|
|||
title = ILLEGAL_IMPLEMENTS_CLAUSE.to_string();
|
||||
}
|
||||
|
||||
Problem::DuplicateHasAbility { ability, region } => {
|
||||
Problem::DuplicateImplementsAbility { ability, region } => {
|
||||
doc = alloc.stack([
|
||||
alloc.concat([
|
||||
alloc.reflow("I already saw that this type variable is bound to the "),
|
||||
|
@ -695,7 +695,7 @@ pub fn can_problem<'b>(
|
|||
title = "DUPLICATE BOUND ABILITY".to_string();
|
||||
}
|
||||
|
||||
Problem::AbilityMemberMissingHasClause {
|
||||
Problem::AbilityMemberMissingImplementsClause {
|
||||
member,
|
||||
ability,
|
||||
region,
|
||||
|
@ -732,7 +732,7 @@ pub fn can_problem<'b>(
|
|||
Problem::AbilityMemberMultipleBoundVars {
|
||||
member,
|
||||
ability,
|
||||
span_has_clauses,
|
||||
span_implements_clauses: span_has_clauses,
|
||||
mut bound_var_names,
|
||||
} => {
|
||||
doc = alloc.stack([
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue