Update to use new square brace formatting

This commit is contained in:
Richard Feldman 2022-05-22 22:43:50 -04:00
parent 0fae5b0bac
commit 4eec34becf
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
120 changed files with 1149 additions and 1155 deletions

View file

@ -336,7 +336,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
},
);
// Bool : [ True, False ]
// Bool : [True, False]
add_alias(
Symbol::BOOL_BOOL,
BuiltinAlias {
@ -347,7 +347,7 @@ pub fn aliases() -> MutMap<Symbol, BuiltinAlias> {
},
);
// Utf8ByteProblem : [ InvalidStartByte, UnexpectedEndOfSequence, ExpectedContinuation, OverlongEncoding, CodepointTooLarge, EncodesSurrogateHalf ]
// Utf8ByteProblem : [InvalidStartByte, UnexpectedEndOfSequence, ExpectedContinuation, OverlongEncoding, CodepointTooLarge, EncodesSurrogateHalf]
add_alias(
Symbol::STR_UT8_BYTE_PROBLEM,
BuiltinAlias {
@ -964,7 +964,7 @@ fn bool_alias_content() -> SolvedType {
#[inline(always)]
pub fn ordering_type() -> SolvedType {
// [ LT, EQ, GT ]
// [LT, EQ, GT]
SolvedType::TagUnion(
vec![
(TagName::Tag("EQ".into()), vec![]),
@ -1053,7 +1053,7 @@ pub fn str_utf8_byte_problem_alias_content() -> SolvedType {
// 1. This must have the same values as the Zig struct Utf8ByteProblem in src/str.zig
// 2. This must be in alphabetical order
//
// [ CodepointTooLarge, EncodesSurrogateHalf, OverlongEncoding, InvalidStartByte, UnexpectedEndOfSequence, ExpectedContinuation ]
// [CodepointTooLarge, EncodesSurrogateHalf, OverlongEncoding, InvalidStartByte, UnexpectedEndOfSequence, ExpectedContinuation]
SolvedType::TagUnion(
vec![
(TagName::Tag("CodepointTooLarge".into()), vec![]),

View file

@ -38,7 +38,7 @@ pub enum SolvedType {
Rigid(Lowercase),
Flex(VarId),
Wildcard,
/// Inline type alias, e.g. `as List a` in `[ Cons a (List a), Nil ] as List a`
/// Inline type alias, e.g. `as List a` in `[Cons a (List a), Nil] as List a`
Record {
fields: Vec<(Lowercase, RecordField<SolvedType>)>,
/// The row type variable in an open record, e.g. the `r` in `{ name: Str }r`.

View file

@ -766,7 +766,7 @@ fn subs_fmt_flat_type(this: &FlatType, subs: &Subs, f: &mut fmt::Formatter) -> f
write!(f, "}}<{:?}>", new_ext)
}
FlatType::TagUnion(tags, ext) => {
write!(f, "[ ")?;
write!(f, "[")?;
let (it, new_ext) = tags.sorted_iterator_and_ext(subs, *ext);
for (name, slice) in it {
@ -794,7 +794,7 @@ fn subs_fmt_flat_type(this: &FlatType, subs: &Subs, f: &mut fmt::Formatter) -> f
)
}
FlatType::RecursiveTagUnion(rec, tags, ext) => {
write!(f, "[ ")?;
write!(f, "[")?;
let (it, new_ext) = tags.sorted_iterator_and_ext(subs, *ext);
for (name, slice) in it {

View file

@ -565,8 +565,8 @@ impl fmt::Debug for Type {
// This is an open tag union, so print the variable
// right after the ']'
//
// e.g. the "*" at the end of `[ Foo ]*`
// or the "r" at the end of `[ DivByZero ]r`
// e.g. the "*" at the end of `[Foo]*`
// or the "r" at the end of `[DivByZero]r`
other.fmt(f)
}
}
@ -585,8 +585,8 @@ impl fmt::Debug for Type {
// This is an open tag union, so print the variable
// right after the ']'
//
// e.g. the "*" at the end of `[ Foo ]*`
// or the "r" at the end of `[ DivByZero ]r`
// e.g. the "*" at the end of `[Foo]*`
// or the "r" at the end of `[DivByZero]r`
other.fmt(f)
}
}
@ -635,8 +635,8 @@ impl fmt::Debug for Type {
// This is an open tag union, so print the variable
// right after the ']'
//
// e.g. the "*" at the end of `[ Foo ]*`
// or the "r" at the end of `[ DivByZero ]r`
// e.g. the "*" at the end of `[Foo]*`
// or the "r" at the end of `[DivByZero]r`
other.fmt(f)
}
}?;
@ -1380,17 +1380,17 @@ impl Type {
///
/// ```roc
/// U8
/// [ A I8 ]
/// [ A [ B [ C U8 ] ] ]
/// [ A (R a) ] as R a
/// [A I8]
/// [A [B [C U8]]]
/// [A (R a)] as R a
/// ```
///
/// The following are not:
///
/// ```roc
/// [ A I8, B U8 ]
/// [ A [ B [ Result U8 {} ] ] ] (Result U8 {} is actually [ Ok U8, Err {} ])
/// [ A { lst: List (R a) } ] as R a (List a is morally [ Cons (List a), Nil ] as List a)
/// [A I8, B U8 ]
/// [A [B [Result U8 {}]]] (Result U8 {} is actually [Ok U8, Err {}])
/// [A { lst: List (R a) }] as R a (List a is morally [Cons (List a), Nil] as List a)
/// ```
pub fn is_narrow(&self) -> bool {
match self.shallow_dealias() {
@ -1920,8 +1920,8 @@ pub enum PatternCategory {
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum AliasKind {
/// A structural alias is something like
/// List a : [ Nil, Cons a (List a) ]
/// It is typed structurally, so that a `List U8` is always equal to a `[ Nil ]_`, for example.
/// List a : [Nil, Cons a (List a)]
/// It is typed structurally, so that a `List U8` is always equal to a `[Nil]_`, for example.
Structural,
/// An opaque alias corresponds to an opaque type from the language syntax, like
/// Age := U32