mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Fix double-wrapping of spaces before implements opaque keyword by making them distinct
This commit is contained in:
parent
8955f3e124
commit
6edfc0aa90
15 changed files with 313 additions and 251 deletions
|
@ -3,14 +3,14 @@ use bumpalo::Bump;
|
|||
use roc_module::called_via::{BinOp, UnaryOp};
|
||||
use roc_region::all::{Loc, Position, Region};
|
||||
|
||||
use crate::ast::ImplementsAbilities;
|
||||
use crate::{
|
||||
ast::{
|
||||
AbilityImpls, AbilityMember, AssignedField, Collection, Defs, Expr, FullAst, Header,
|
||||
Implements, ImplementsAbilities, ImplementsAbility, ImplementsClause, ImportAlias,
|
||||
ImportAsKeyword, ImportExposingKeyword, ImportedModuleName, IngestedFileAnnotation,
|
||||
IngestedFileImport, ModuleImport, ModuleImportParams, Pattern, PatternAs, Spaced, Spaces,
|
||||
SpacesBefore, StrLiteral, StrSegment, Tag, TypeAnnotation, TypeDef, TypeHeader, ValueDef,
|
||||
WhenBranch,
|
||||
Implements, ImplementsAbility, ImplementsClause, ImportAlias, ImportAsKeyword,
|
||||
ImportExposingKeyword, ImportedModuleName, IngestedFileAnnotation, IngestedFileImport,
|
||||
ModuleImport, ModuleImportParams, Pattern, PatternAs, Spaced, Spaces, SpacesBefore,
|
||||
StrLiteral, StrSegment, Tag, TypeAnnotation, TypeDef, TypeHeader, ValueDef, WhenBranch,
|
||||
},
|
||||
header::{
|
||||
AppHeader, ExposedName, ExposesKeyword, HostedHeader, ImportsEntry, ImportsKeyword,
|
||||
|
@ -372,7 +372,7 @@ impl<'a> Normalize<'a> for TypeDef<'a> {
|
|||
vars: vars.normalize(arena),
|
||||
},
|
||||
typ: typ.normalize(arena),
|
||||
derived: derived.normalize(arena),
|
||||
derived: derived.map(|item| &*arena.alloc(item.normalize(arena))),
|
||||
},
|
||||
Ability {
|
||||
header: TypeHeader { name, vars },
|
||||
|
@ -1001,6 +1001,17 @@ impl<'a> Normalize<'a> for AbilityImpls<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Normalize<'a> for ImplementsAbilities<'a> {
|
||||
fn normalize(&self, arena: &'a Bump) -> Self {
|
||||
ImplementsAbilities {
|
||||
before_implements_kw: &[],
|
||||
implements: Region::zero(),
|
||||
after_implements_kw: &[],
|
||||
item: self.item.normalize(arena),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Normalize<'a> for ImplementsAbility<'a> {
|
||||
fn normalize(&self, arena: &'a Bump) -> Self {
|
||||
match *self {
|
||||
|
@ -1017,18 +1028,6 @@ impl<'a> Normalize<'a> for ImplementsAbility<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Normalize<'a> for ImplementsAbilities<'a> {
|
||||
fn normalize(&self, arena: &'a Bump) -> Self {
|
||||
match *self {
|
||||
ImplementsAbilities::Implements(derived) => {
|
||||
ImplementsAbilities::Implements(derived.normalize(arena))
|
||||
}
|
||||
ImplementsAbilities::SpaceBefore(derived, _)
|
||||
| ImplementsAbilities::SpaceAfter(derived, _) => derived.normalize(arena),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Normalize<'a> for PatternAs<'a> {
|
||||
fn normalize(&self, arena: &'a Bump) -> Self {
|
||||
PatternAs {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue