Merge remote-tracking branch 'remote/main' into upgrade-llvm-zig

This commit is contained in:
Luke Boswell 2024-11-29 08:58:47 +11:00
commit 2feb5d3c2e
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
426 changed files with 8889 additions and 4190 deletions

View file

@ -30,3 +30,4 @@ soa = { path = "../../soa" }
indoc.workspace = true
insta.workspace = true
pretty_assertions.workspace = true
test_compile.workspace = true

View file

@ -2,12 +2,12 @@ use crate::env::Env;
use crate::procedure::{QualifiedReference, References};
use crate::scope::{PendingAbilitiesInScope, Scope, SymbolLookup};
use roc_collections::{ImMap, MutSet, SendMap, VecMap, VecSet};
use roc_module::ident::{Ident, Lowercase, TagName};
use roc_module::ident::{Ident, IdentSuffix, Lowercase, TagName};
use roc_module::symbol::Symbol;
use roc_parse::ast::{
AssignedField, ExtractSpaces, FunctionArrow, Pattern, Tag, TypeAnnotation, TypeHeader,
};
use roc_problem::can::ShadowKind;
use roc_problem::can::{Problem, ShadowKind};
use roc_region::all::{Loc, Region};
use roc_types::subs::{VarStore, Variable};
use roc_types::types::{
@ -132,7 +132,7 @@ pub struct AbleVariable {
pub first_seen: Region,
}
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, PartialEq)]
pub struct IntroducedVariables {
pub wildcards: Vec<Loc<Variable>>,
pub lambda_sets: Vec<Variable>,
@ -482,7 +482,6 @@ pub fn find_type_def_symbols(
AssignedField::LabelOnly(_) => {}
AssignedField::SpaceBefore(inner, _)
| AssignedField::SpaceAfter(inner, _) => inner_stack.push(inner),
AssignedField::Malformed(_) => {}
}
}
@ -507,7 +506,6 @@ pub fn find_type_def_symbols(
Tag::SpaceBefore(inner, _) | Tag::SpaceAfter(inner, _) => {
inner_stack.push(inner)
}
Tag::Malformed(_) => {}
}
}
@ -1355,7 +1353,7 @@ fn can_assigned_fields<'a>(
// field names we've seen so far in this record
let mut seen = std::collections::HashMap::with_capacity(fields.len());
'outer: for loc_field in fields.iter() {
for loc_field in fields.iter() {
let mut field = &loc_field.value;
// use this inner loop to unwrap the SpaceAfter/SpaceBefore
@ -1378,6 +1376,8 @@ fn can_assigned_fields<'a>(
);
let label = Lowercase::from(field_name.value);
check_record_field_suffix(env, label.suffix(), &field_type, &loc_field.region);
field_types.insert(label.clone(), RigidRequired(field_type));
break 'inner label;
@ -1396,6 +1396,8 @@ fn can_assigned_fields<'a>(
);
let label = Lowercase::from(field_name.value);
check_record_field_suffix(env, label.suffix(), &field_type, &loc_field.region);
field_types.insert(label.clone(), RigidOptional(field_type));
break 'inner label;
@ -1426,12 +1428,6 @@ fn can_assigned_fields<'a>(
field = nested;
continue 'inner;
}
Malformed(string) => {
malformed(env, region, string);
// completely skip this element, advance to the next tag
continue 'outer;
}
}
};
@ -1450,6 +1446,23 @@ fn can_assigned_fields<'a>(
field_types
}
fn check_record_field_suffix(
env: &mut Env,
suffix: IdentSuffix,
field_type: &Type,
region: &Region,
) {
match (suffix, field_type) {
(IdentSuffix::None, Type::Function(_, _, _, fx)) if **fx == Type::Effectful => env
.problems
.push(Problem::UnsuffixedEffectfulRecordField(*region)),
(IdentSuffix::Bang, Type::Function(_, _, _, fx)) if **fx == Type::Pure => {
env.problems.push(Problem::SuffixedPureRecordField(*region))
}
_ => {}
}
}
// TODO trim down these arguments!
#[allow(clippy::too_many_arguments)]
fn can_assigned_tuple_elems(
@ -1501,7 +1514,7 @@ fn can_tags<'a>(
// tag names we've seen so far in this tag union
let mut seen = std::collections::HashMap::with_capacity(tags.len());
'outer: for loc_tag in tags.iter() {
for loc_tag in tags.iter() {
let mut tag = &loc_tag.value;
// use this inner loop to unwrap the SpaceAfter/SpaceBefore
@ -1540,12 +1553,6 @@ fn can_tags<'a>(
tag = nested;
continue 'inner;
}
Tag::Malformed(string) => {
malformed(env, region, string);
// completely skip this element, advance to the next tag
continue 'outer;
}
}
};

View file

@ -116,7 +116,7 @@ map_symbol_to_lowlevel_and_arity! {
StrIsEmpty; STR_IS_EMPTY; 1,
StrStartsWith; STR_STARTS_WITH; 2,
StrEndsWith; STR_ENDS_WITH; 2,
StrSplit; STR_SPLIT; 2,
StrSplitOn; STR_SPLIT_ON; 2,
StrCountUtf8Bytes; STR_COUNT_UTF8_BYTES; 1,
StrFromUtf8; STR_FROM_UTF8_LOWLEVEL; 1,
StrToUtf8; STR_TO_UTF8; 1,

View file

@ -618,15 +618,10 @@ impl Constraints {
Constraint::FxSuffix(constraint_index)
}
pub fn fx_record_field_suffix(
&mut self,
suffix: IdentSuffix,
variable: Variable,
region: Region,
) -> Constraint {
pub fn fx_record_field_unsuffixed(&mut self, variable: Variable, region: Region) -> Constraint {
let type_index = Self::push_type_variable(variable);
let constraint = FxSuffixConstraint {
kind: FxSuffixKind::RecordField(suffix),
kind: FxSuffixKind::UnsuffixedRecordField,
type_index,
region,
};
@ -934,7 +929,7 @@ pub struct FxExpectation {
pub ann_region: Option<Region>,
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum FxCallKind {
Call(Option<Symbol>),
Stmt,
@ -948,23 +943,30 @@ pub struct FxSuffixConstraint {
pub region: Region,
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum FxSuffixKind {
Let(Symbol),
Pattern(Symbol),
RecordField(IdentSuffix),
UnsuffixedRecordField,
}
impl FxSuffixKind {
pub fn suffix(&self) -> IdentSuffix {
match self {
Self::Let(symbol) | Self::Pattern(symbol) => symbol.suffix(),
Self::RecordField(suffix) => *suffix,
Self::UnsuffixedRecordField => IdentSuffix::None,
}
}
pub fn symbol(&self) -> Option<&Symbol> {
match self {
Self::Let(symbol) | Self::Pattern(symbol) => Some(symbol),
Self::UnsuffixedRecordField => None,
}
}
}
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ExpectEffectfulReason {
Stmt,
Ignored,

View file

@ -694,16 +694,6 @@ fn deep_copy_expr_help<C: CopyEnv>(env: &mut C, copied: &mut Vec<Variable>, expr
lookups_in_cond: lookups_in_cond.to_vec(),
},
ExpectFx {
loc_condition,
loc_continuation,
lookups_in_cond,
} => ExpectFx {
loc_condition: Box::new(loc_condition.map(|e| go_help!(e))),
loc_continuation: Box::new(loc_continuation.map(|e| go_help!(e))),
lookups_in_cond: lookups_in_cond.to_vec(),
},
Return {
return_value,
return_var,

View file

@ -62,7 +62,6 @@ fn print_declarations_help<'a>(
toplevel_function(c, f, symbol, function_def, &body.value)
}
DeclarationTag::Expectation => todo!(),
DeclarationTag::ExpectationFx => todo!(),
DeclarationTag::Destructure(_) => todo!(),
DeclarationTag::MutualRecursion { .. } => {
// the defs will be printed next
@ -453,7 +452,6 @@ fn expr<'a>(c: &Ctx, p: EPrec, f: &'a Arena<'a>, e: &'a Expr) -> DocBuilder<'a,
),
Dbg { .. } => todo!(),
Expect { .. } => todo!(),
ExpectFx { .. } => todo!(),
Return { .. } => todo!(),
TypedHole(_) => todo!(),
RuntimeError(_) => todo!(),

View file

@ -63,7 +63,7 @@ use std::io::Read;
use std::path::PathBuf;
use std::sync::Arc;
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct Def {
pub loc_pattern: Loc<Pattern>,
pub loc_expr: Loc<Expr>,
@ -91,7 +91,7 @@ impl Def {
}
}
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DefKind {
/// A def that introduces identifiers
Let,
@ -123,7 +123,7 @@ impl DefKind {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct Annotation {
pub signature: Type,
pub introduced_variables: IntroducedVariables,
@ -171,7 +171,6 @@ pub(crate) struct CanDefs {
defs: Vec<Option<Def>>,
dbgs: ExpectsOrDbgs,
expects: ExpectsOrDbgs,
expects_fx: ExpectsOrDbgs,
def_ordering: DefOrdering,
aliases: VecMap<Symbol, Alias>,
}
@ -343,7 +342,6 @@ pub enum Declaration {
DeclareRec(Vec<Def>, IllegalCycleMark),
Builtin(Def),
Expects(ExpectsOrDbgs),
ExpectsFx(ExpectsOrDbgs),
/// If we know a cycle is illegal during canonicalization.
/// Otherwise we will try to detect this during solving; see [`IllegalCycleMark`].
InvalidCycle(Vec<CycleEntry>),
@ -358,7 +356,6 @@ impl Declaration {
InvalidCycle { .. } => 0,
Builtin(_) => 0,
Expects(_) => 0,
ExpectsFx(_) => 0,
}
}
@ -374,7 +371,7 @@ impl Declaration {
&cycles.first().unwrap().expr_region,
&cycles.last().unwrap().expr_region,
),
Declaration::Expects(expects) | Declaration::ExpectsFx(expects) => Region::span_across(
Declaration::Expects(expects) => Region::span_across(
expects.regions.first().unwrap(),
expects.regions.last().unwrap(),
),
@ -715,10 +712,6 @@ fn canonicalize_claimed_ability_impl<'a>(
});
Err(())
}
AssignedField::Malformed(_) => {
// An error will already have been reported
Err(())
}
AssignedField::SpaceBefore(_, _)
| AssignedField::SpaceAfter(_, _)
| AssignedField::IgnoredValue(_, _, _) => {
@ -1174,7 +1167,6 @@ fn canonicalize_value_defs<'a>(
let mut pending_value_defs = Vec::with_capacity(value_defs.len());
let mut pending_dbgs = Vec::with_capacity(value_defs.len());
let mut pending_expects = Vec::with_capacity(value_defs.len());
let mut pending_expect_fx = Vec::with_capacity(value_defs.len());
let mut imports_introduced = Vec::with_capacity(value_defs.len());
@ -1194,9 +1186,6 @@ fn canonicalize_value_defs<'a>(
PendingValue::Expect(pending_expect) => {
pending_expects.push(pending_expect);
}
PendingValue::ExpectFx(pending_expect) => {
pending_expect_fx.push(pending_expect);
}
PendingValue::ModuleImport(PendingModuleImport {
module_id,
region,
@ -1282,7 +1271,6 @@ fn canonicalize_value_defs<'a>(
let mut dbgs = ExpectsOrDbgs::with_capacity(pending_dbgs.len());
let mut expects = ExpectsOrDbgs::with_capacity(pending_expects.len());
let mut expects_fx = ExpectsOrDbgs::with_capacity(pending_expects.len());
for pending in pending_dbgs {
let (loc_can_condition, can_output) = canonicalize_expr(
@ -1312,25 +1300,10 @@ fn canonicalize_value_defs<'a>(
output.union(can_output);
}
for pending in pending_expect_fx {
let (loc_can_condition, can_output) = canonicalize_expr(
env,
var_store,
scope,
pending.condition.region,
&pending.condition.value,
);
expects_fx.push(loc_can_condition, pending.preceding_comment);
output.union(can_output);
}
let can_defs = CanDefs {
defs,
dbgs,
expects,
expects_fx,
def_ordering,
aliases,
};
@ -1738,7 +1711,6 @@ pub(crate) fn sort_top_level_can_defs(
defs,
dbgs: _,
expects,
expects_fx,
def_ordering,
aliases,
} = defs;
@ -1769,19 +1741,6 @@ pub(crate) fn sort_top_level_can_defs(
declarations.push_expect(preceding_comment, name, Loc::at(region, condition));
}
let it = expects_fx
.conditions
.into_iter()
.zip(expects_fx.regions)
.zip(expects_fx.preceding_comment);
for ((condition, region), preceding_comment) in it {
// an `expect` does not have a user-defined name, but we'll need a name to call the expectation
let name = scope.gen_unique_symbol();
declarations.push_expect_fx(preceding_comment, name, Loc::at(region, condition));
}
for (symbol, alias) in aliases.into_iter() {
output.aliases.insert(symbol, alias);
}
@ -2019,7 +1978,6 @@ pub(crate) fn sort_can_defs(
mut defs,
dbgs,
expects,
expects_fx,
def_ordering,
aliases,
} = defs;
@ -2153,10 +2111,6 @@ pub(crate) fn sort_can_defs(
declarations.push(Declaration::Expects(expects));
}
if !expects_fx.conditions.is_empty() {
declarations.push(Declaration::ExpectsFx(expects_fx));
}
(declarations, output)
}
@ -2879,10 +2833,6 @@ fn decl_to_let(decl: Declaration, loc_ret: Loc<Expr>) -> Loc<Expr> {
loc_ret
}
Declaration::ExpectsFx(expects) => {
// Expects should only be added to top-level decls, not to let-exprs!
unreachable!("{:?}", &expects)
}
}
}
@ -3082,7 +3032,6 @@ enum PendingValue<'a> {
Def(PendingValueDef<'a>),
Dbg(PendingExpectOrDbg<'a>),
Expect(PendingExpectOrDbg<'a>),
ExpectFx(PendingExpectOrDbg<'a>),
ModuleImport(PendingModuleImport<'a>),
SignatureDefMismatch,
InvalidIngestedFile,
@ -3222,14 +3171,6 @@ fn to_pending_value_def<'a>(
preceding_comment: *preceding_comment,
}),
ExpectFx {
condition,
preceding_comment,
} => PendingValue::ExpectFx(PendingExpectOrDbg {
condition,
preceding_comment: *preceding_comment,
}),
ModuleImport(module_import) => {
let qualified_module_name: QualifiedModuleName = module_import.name.value.into();
let module_name = qualified_module_name.module.clone();

View file

@ -167,16 +167,6 @@ fn desugar_value_def<'a>(
preceding_comment: *preceding_comment,
}
}
ExpectFx {
condition,
preceding_comment,
} => {
let desugared_condition = &*env.arena.alloc(desugar_expr(env, scope, condition));
ExpectFx {
condition: desugared_condition,
preceding_comment: *preceding_comment,
}
}
ModuleImport(roc_parse::ast::ModuleImport {
before_name,
name,
@ -380,8 +370,8 @@ pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>)
}
},
// TODO support desugaring of Dbg and ExpectFx
Dbg { .. } | ExpectFx { .. } => value_def,
// TODO support desugaring of Dbg
Dbg { .. } => value_def,
ModuleImport { .. } | IngestedFileImport(_) | StmtAfterExpr => value_def,
Stmt(..) => {
@ -407,7 +397,6 @@ pub fn desugar_expr<'a>(
| AccessorFunction(_)
| Underscore { .. }
| MalformedIdent(_, _)
| MalformedClosure
| MalformedSuffixed(..)
| PrecedenceConflict { .. }
| EmptyRecordBuilder(_)
@ -712,7 +701,6 @@ pub fn desugar_expr<'a>(
AssignedField::SpaceBefore(_, _) | AssignedField::SpaceAfter(_, _) => {
unreachable!("Should have been desugared in `desugar_field`")
}
AssignedField::Malformed(_name) => continue,
};
field_data.push(FieldData {
@ -1112,15 +1100,6 @@ pub fn desugar_expr<'a>(
region: loc_expr.region,
})
}
Expect(condition, continuation) => {
let desugared_condition = &*env.arena.alloc(desugar_expr(env, scope, condition));
let desugared_continuation = &*env.arena.alloc(desugar_expr(env, scope, continuation));
env.arena.alloc(Loc {
value: Expect(desugared_condition, desugared_continuation),
region: loc_expr.region,
})
}
Dbg => {
// Allow naked dbg, necessary for piping values into dbg with the `Pizza` binop
loc_expr
@ -1316,8 +1295,6 @@ fn desugar_field<'a>(
}
SpaceBefore(field, _spaces) => desugar_field(env, scope, field),
SpaceAfter(field, _spaces) => desugar_field(env, scope, field),
Malformed(string) => Malformed(string),
}
}

View file

@ -2,7 +2,7 @@ use crate::pattern::Pattern;
use roc_region::all::{Loc, Region};
use roc_types::types::{AnnotationSource, PReason, Reason};
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub enum Expected<T> {
NoExpectation(T),
FromAnnotation(Loc<Pattern>, usize, AnnotationSource, T),
@ -10,7 +10,7 @@ pub enum Expected<T> {
}
/// Like Expected, but for Patterns.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub enum PExpected<T> {
NoExpectation(T),
ForReason(PReason, T, Region),

View file

@ -85,7 +85,55 @@ impl Display for IntValue {
}
}
#[derive(Clone, Debug)]
impl IntValue {
pub fn as_u8(self) -> u8 {
self.as_u128() as u8
}
pub fn as_i8(self) -> i8 {
self.as_i128() as i8
}
pub fn as_u16(self) -> u16 {
self.as_u128() as u16
}
pub fn as_i16(self) -> i16 {
self.as_i128() as i16
}
pub fn as_u32(self) -> u32 {
self.as_u128() as u32
}
pub fn as_i32(self) -> i32 {
self.as_i128() as i32
}
pub fn as_u64(self) -> u64 {
self.as_u128() as u64
}
pub fn as_i64(self) -> i64 {
self.as_i128() as i64
}
pub fn as_u128(self) -> u128 {
match self {
IntValue::I128(i128) => i128::from_ne_bytes(i128) as u128,
IntValue::U128(u128) => u128::from_ne_bytes(u128),
}
}
pub fn as_i128(self) -> i128 {
match self {
IntValue::I128(i128) => i128::from_ne_bytes(i128),
IntValue::U128(u128) => u128::from_ne_bytes(u128) as i128,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub enum Expr {
// Literals
@ -104,7 +152,7 @@ pub enum Expr {
loc_elems: Vec<Loc<Expr>>,
},
// An ingested files, it's bytes, and the type variable.
// An ingested files, its bytes, and the type variable.
IngestedFile(Box<PathBuf>, Arc<Vec<u8>>, Variable),
// Lookups
@ -131,7 +179,7 @@ pub enum Expr {
/// The actual condition of the when expression.
loc_cond: Box<Loc<Expr>>,
cond_var: Variable,
/// Result type produced by the branches.
/// Type of each branch (and therefore the type of the entire `when` expression)
expr_var: Variable,
region: Region,
/// The branches of the when, and the type of the condition that they expect to be matched
@ -271,13 +319,6 @@ pub enum Expr {
lookups_in_cond: Vec<ExpectLookup>,
},
// not parsed, but is generated when lowering toplevel effectful expects
ExpectFx {
loc_condition: Box<Loc<Expr>>,
loc_continuation: Box<Loc<Expr>>,
lookups_in_cond: Vec<ExpectLookup>,
},
Dbg {
source_location: Box<str>,
source: Box<str>,
@ -299,7 +340,7 @@ pub enum Expr {
RuntimeError(RuntimeError),
}
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct ExpectLookup {
pub symbol: Symbol,
pub var: Variable,
@ -364,7 +405,6 @@ impl Expr {
Category::OpaqueWrap(opaque_name)
}
Self::Expect { .. } => Category::Expect,
Self::ExpectFx { .. } => Category::Expect,
Self::Crash { .. } => Category::Crash,
Self::Return { .. } => Category::Return,
@ -378,7 +418,7 @@ impl Expr {
/// Stores exhaustiveness-checking metadata for a closure argument that may
/// have an annotated type.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct AnnotatedMark {
pub annotation_var: Variable,
pub exhaustive: ExhaustiveMark,
@ -402,7 +442,7 @@ impl AnnotatedMark {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct ClosureData {
pub function_type: Variable,
pub closure_type: Variable,
@ -499,7 +539,7 @@ impl StructAccessorData {
/// An opaque wrapper like `@Foo`, which is equivalent to `\p -> @Foo p`
/// These are desugared to closures, but we distinguish them so we can have
/// better error messages during constraint generation.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct OpaqueWrapFunctionData {
pub opaque_name: Symbol,
pub opaque_var: Variable,
@ -571,7 +611,7 @@ impl OpaqueWrapFunctionData {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct Field {
pub var: Variable,
// The region of the full `foo: f bar`, rather than just `f bar`
@ -595,7 +635,7 @@ impl Recursive {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct WhenBranchPattern {
pub pattern: Loc<Pattern>,
/// Degenerate branch patterns are those that don't fully bind symbols that the branch body
@ -604,7 +644,7 @@ pub struct WhenBranchPattern {
pub degenerate: bool,
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct WhenBranch {
pub patterns: Vec<WhenBranchPattern>,
pub value: Loc<Expr>,
@ -1196,36 +1236,6 @@ pub fn canonicalize_expr<'a>(
}
}
}
ast::Expr::Expect(condition, continuation) => {
let mut output = Output::default();
let (loc_condition, output1) =
canonicalize_expr(env, var_store, scope, condition.region, &condition.value);
// Get all the lookups that were referenced in the condition,
// so we can print their values later.
let lookups_in_cond = get_lookup_symbols(&loc_condition.value);
let (loc_continuation, output2) = canonicalize_expr(
env,
var_store,
scope,
continuation.region,
&continuation.value,
);
output.union(output1);
output.union(output2);
(
Expect {
loc_condition: Box::new(loc_condition),
loc_continuation: Box::new(loc_continuation),
lookups_in_cond,
},
output,
)
}
ast::Expr::Dbg => {
// Dbg was not desugared as either part of an `Apply` or a `Pizza` binop, so it's
// invalid.
@ -1391,10 +1401,6 @@ pub fn canonicalize_expr<'a>(
Output::default(),
)
}
ast::Expr::MalformedClosure => {
use roc_problem::can::RuntimeError::*;
(RuntimeError(MalformedClosure(region)), Output::default())
}
ast::Expr::MalformedIdent(name, bad_ident) => {
use roc_problem::can::RuntimeError::*;
@ -1976,10 +1982,6 @@ fn canonicalize_field<'a>(
SpaceBefore(sub_field, _) | SpaceAfter(sub_field, _) => {
canonicalize_field(env, var_store, scope, sub_field)
}
Malformed(_string) => {
internal_error!("TODO canonicalize malformed record field");
}
}
}
@ -2225,28 +2227,6 @@ pub fn inline_calls(var_store: &mut VarStore, expr: Expr) -> Expr {
}
}
ExpectFx {
loc_condition,
loc_continuation,
lookups_in_cond,
} => {
let loc_condition = Loc {
region: loc_condition.region,
value: inline_calls(var_store, loc_condition.value),
};
let loc_continuation = Loc {
region: loc_continuation.region,
value: inline_calls(var_store, loc_continuation.value),
};
ExpectFx {
loc_condition: Box::new(loc_condition),
loc_continuation: Box::new(loc_continuation),
lookups_in_cond,
}
}
Dbg {
source_location,
source,
@ -2568,12 +2548,10 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
| ast::Expr::Underscore(_)
| ast::Expr::MalformedIdent(_, _)
| ast::Expr::Tag(_)
| ast::Expr::OpaqueRef(_)
| ast::Expr::MalformedClosure => true,
| ast::Expr::OpaqueRef(_) => true,
// Newlines are disallowed inside interpolation, and these all require newlines
ast::Expr::DbgStmt(_, _)
| ast::Expr::LowLevelDbg(_, _, _)
| ast::Expr::Expect(_, _)
| ast::Expr::Return(_, _)
| ast::Expr::When(_, _)
| ast::Expr::Backpassing(_, _, _)
@ -2604,7 +2582,7 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
| ast::AssignedField::IgnoredValue(_label, loc_comments, loc_val) => {
loc_comments.is_empty() && is_valid_interpolation(&loc_val.value)
}
ast::AssignedField::Malformed(_) | ast::AssignedField::LabelOnly(_) => true,
ast::AssignedField::LabelOnly(_) => true,
ast::AssignedField::SpaceBefore(_, _) | ast::AssignedField::SpaceAfter(_, _) => false,
}),
ast::Expr::Tuple(fields) => fields
@ -2655,7 +2633,7 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
| ast::AssignedField::IgnoredValue(_label, loc_comments, loc_val) => {
loc_comments.is_empty() && is_valid_interpolation(&loc_val.value)
}
ast::AssignedField::Malformed(_) | ast::AssignedField::LabelOnly(_) => true,
ast::AssignedField::LabelOnly(_) => true,
ast::AssignedField::SpaceBefore(_, _)
| ast::AssignedField::SpaceAfter(_, _) => false,
})
@ -2668,7 +2646,7 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
| ast::AssignedField::IgnoredValue(_label, loc_comments, loc_val) => {
loc_comments.is_empty() && is_valid_interpolation(&loc_val.value)
}
ast::AssignedField::Malformed(_) | ast::AssignedField::LabelOnly(_) => true,
ast::AssignedField::LabelOnly(_) => true,
ast::AssignedField::SpaceBefore(_, _)
| ast::AssignedField::SpaceAfter(_, _) => false,
})
@ -3028,24 +3006,6 @@ impl Declarations {
index
}
pub fn push_expect_fx(
&mut self,
preceding_comment: Region,
name: Symbol,
loc_expr: Loc<Expr>,
) -> usize {
let index = self.declarations.len();
self.declarations.push(DeclarationTag::ExpectationFx);
self.variables.push(Variable::BOOL);
self.symbols.push(Loc::at(preceding_comment, name));
self.annotations.push(None);
self.expressions.push(loc_expr);
index
}
pub fn push_value_def(
&mut self,
symbol: Loc<Symbol>,
@ -3298,12 +3258,6 @@ impl Declarations {
collector.visit_expr(&loc_expr.value, loc_expr.region, var);
}
ExpectationFx => {
let loc_expr =
toplevel_expect_to_inline_expect_fx(self.expressions[index].clone());
collector.visit_expr(&loc_expr.value, loc_expr.region, var);
}
}
}
@ -3322,7 +3276,6 @@ roc_error_macros::assert_sizeof_default!(DeclarationTag, 8);
pub enum DeclarationTag {
Value,
Expectation,
ExpectationFx,
Function(Index<Loc<FunctionDef>>),
Recursive(Index<Loc<FunctionDef>>),
TailRecursive(Index<Loc<FunctionDef>>),
@ -3340,7 +3293,7 @@ impl DeclarationTag {
match self {
Function(_) | Recursive(_) | TailRecursive(_) => 1,
Value => 1,
Expectation | ExpectationFx => 1,
Expectation => 1,
Destructure(_) => 1,
MutualRecursion { length, .. } => length as usize + 1,
}
@ -3486,9 +3439,6 @@ pub(crate) fn get_lookup_symbols(expr: &Expr) -> Vec<ExpectLookup> {
Expr::Expect {
loc_continuation, ..
}
| Expr::ExpectFx {
loc_continuation, ..
}
| Expr::Dbg {
loc_continuation, ..
} => {
@ -3544,15 +3494,7 @@ pub(crate) fn get_lookup_symbols(expr: &Expr) -> Vec<ExpectLookup> {
/// This is supposed to happen just before monomorphization:
/// all type errors and such are generated from the user source,
/// but this transformation means that we don't need special codegen for toplevel expects
pub fn toplevel_expect_to_inline_expect_pure(loc_expr: Loc<Expr>) -> Loc<Expr> {
toplevel_expect_to_inline_expect_help(loc_expr, false)
}
pub fn toplevel_expect_to_inline_expect_fx(loc_expr: Loc<Expr>) -> Loc<Expr> {
toplevel_expect_to_inline_expect_help(loc_expr, true)
}
fn toplevel_expect_to_inline_expect_help(mut loc_expr: Loc<Expr>, has_effects: bool) -> Loc<Expr> {
pub fn toplevel_expect_to_inline_expect_pure(mut loc_expr: Loc<Expr>) -> Loc<Expr> {
enum StoredDef {
NonRecursive(Region, Box<Def>),
Recursive(Region, Vec<Def>, IllegalCycleMark),
@ -3590,18 +3532,10 @@ fn toplevel_expect_to_inline_expect_help(mut loc_expr: Loc<Expr>, has_effects: b
}
let expect_region = loc_expr.region;
let expect = if has_effects {
Expr::ExpectFx {
loc_condition: Box::new(loc_expr),
loc_continuation: Box::new(Loc::at_zero(Expr::EmptyRecord)),
lookups_in_cond,
}
} else {
Expr::Expect {
loc_condition: Box::new(loc_expr),
loc_continuation: Box::new(Loc::at_zero(Expr::EmptyRecord)),
lookups_in_cond,
}
let expect = Expr::Expect {
loc_condition: Box::new(loc_expr),
loc_continuation: Box::new(Loc::at_zero(Expr::EmptyRecord)),
lookups_in_cond,
};
let mut loc_expr = Loc::at(expect_region, expect);
@ -3633,11 +3567,6 @@ impl crate::traverse::Visitor for ExpectCollector {
lookups_in_cond,
loc_condition,
..
}
| Expr::ExpectFx {
lookups_in_cond,
loc_condition,
..
} => {
self.expects
.insert(loc_condition.region, lookups_in_cond.to_vec());

View file

@ -609,7 +609,6 @@ pub fn canonicalize_module_defs<'a>(
// the declarations of this group will be treaded individually by later iterations
}
Expectation => { /* ignore */ }
ExpectationFx => { /* ignore */ }
}
}
@ -747,14 +746,6 @@ pub fn canonicalize_module_defs<'a>(
&mut fix_closures_closure_captures,
);
}
ExpectationFx => {
let loc_expr = &mut declarations.expressions[index];
fix_values_captured_in_closure_expr(
&mut loc_expr.value,
&mut fix_closures_no_capture_symbols,
&mut fix_closures_closure_captures,
);
}
}
}
@ -956,11 +947,6 @@ fn fix_values_captured_in_closure_expr(
loc_continuation,
..
}
| ExpectFx {
loc_condition,
loc_continuation,
..
}
| Dbg {
loc_message: loc_condition,
loc_continuation,

View file

@ -19,7 +19,7 @@ use roc_types::types::{LambdaSet, OptAbleVar, PatternCategory, Type};
/// A pattern, including possible problems (e.g. shadowing) so that
/// codegen can generate a runtime error if this pattern is reached.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum Pattern {
Identifier(Symbol),
As(Box<Loc<Pattern>>, Symbol),
@ -198,7 +198,7 @@ impl Pattern {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct ListPatterns {
pub patterns: Vec<Loc<Pattern>>,
/// Where a rest pattern splits patterns before and after it, if it does at all.
@ -207,6 +207,7 @@ pub struct ListPatterns {
/// [ .., A, B ] -> patterns = [A, B], rest = 0
/// [ A, .., B ] -> patterns = [A, B], rest = 1
/// [ A, B, .. ] -> patterns = [A, B], rest = 2
/// Optionally, the rest pattern can be named - e.g. `[ A, B, ..others ]`
pub opt_rest: Option<(usize, Option<Loc<Symbol>>)>,
}
@ -228,7 +229,7 @@ impl ListPatterns {
}
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct RecordDestruct {
pub var: Variable,
pub label: Lowercase,
@ -236,14 +237,14 @@ pub struct RecordDestruct {
pub typ: DestructType,
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct TupleDestruct {
pub var: Variable,
pub destruct_index: usize,
pub typ: (Variable, Loc<Pattern>),
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum DestructType {
Required,
Optional(Variable, Loc<Expr>),

View file

@ -155,49 +155,6 @@ pub fn unwrap_suffixed_expression<'a>(
Expr::LowLevelDbg(..) => unwrap_low_level_dbg(arena, loc_expr, maybe_def_pat),
Expr::Expect(condition, continuation) => {
if is_expr_suffixed(&condition.value) {
// we cannot unwrap a suffixed expression within expect
// e.g. expect (foo! "bar")
return Err(EUnwrapped::Malformed);
}
match unwrap_suffixed_expression(arena, continuation, maybe_def_pat) {
Ok(unwrapped_expr) => {
let new_expect = arena
.alloc(Loc::at(loc_expr.region, Expect(condition, unwrapped_expr)));
return Ok(new_expect);
}
Err(EUnwrapped::UnwrappedDefExpr {
loc_expr: unwrapped_expr,
target,
}) => {
let new_expect = arena
.alloc(Loc::at(loc_expr.region, Expect(condition, unwrapped_expr)));
Err(EUnwrapped::UnwrappedDefExpr {
loc_expr: new_expect,
target,
})
}
Err(EUnwrapped::UnwrappedSubExpr {
sub_arg: unwrapped_expr,
sub_pat,
sub_new,
target,
}) => {
let new_expect = arena
.alloc(Loc::at(loc_expr.region, Expect(condition, unwrapped_expr)));
Err(EUnwrapped::UnwrappedSubExpr {
sub_arg: new_expect,
sub_pat,
sub_new,
target,
})
}
Err(EUnwrapped::Malformed) => Err(EUnwrapped::Malformed),
}
}
// we only need to unwrap some expressions, leave the rest as is
_ => Ok(loc_expr),
}
@ -680,7 +637,7 @@ pub fn unwrap_suffixed_expression_defs_help<'a>(
};
let maybe_suffixed_value_def = match current_value_def {
Annotation(..) | Dbg{..} | Expect{..} | ExpectFx{..} | Stmt(..) | ModuleImport{..} | IngestedFileImport(_) => None,
Annotation(..) | Dbg{..} | Expect{..} | Stmt(..) | ModuleImport{..} | IngestedFileImport(_) => None,
AnnotatedBody { body_pattern, body_expr, ann_type, ann_pattern, .. } => Some((body_pattern, body_expr, Some((ann_pattern, ann_type)))),
Body (def_pattern, def_expr) => Some((def_pattern, def_expr, None)),
StmtAfterExpr => None,

View file

@ -107,7 +107,7 @@ pub fn walk_decls<V: Visitor>(visitor: &mut V, decls: &Declarations) {
annotation: decls.annotations[index].as_ref(),
}
}
Expectation | ExpectationFx => {
Expectation => {
let loc_condition = &decls.expressions[index];
DeclarationInfo::Expectation { loc_condition }
@ -385,18 +385,6 @@ pub fn walk_expr<V: Visitor>(visitor: &mut V, expr: &Expr, var: Variable) {
Variable::NULL,
);
}
Expr::ExpectFx {
loc_condition,
loc_continuation,
lookups_in_cond: _,
} => {
visitor.visit_expr(&loc_condition.value, loc_condition.region, Variable::BOOL);
visitor.visit_expr(
&loc_continuation.value,
loc_continuation.region,
Variable::NULL,
);
}
Expr::Dbg {
variable,
source: _,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-28,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -65,10 +66,10 @@ Defs {
@15-22,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-25,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -49,10 +50,10 @@ Defs {
@15-19,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-43,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -59,10 +60,10 @@ Defs {
@15-33,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-45,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -59,10 +60,10 @@ Defs {
@15-35,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-28,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -49,10 +50,10 @@ Defs {
@15-22,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-26,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -39,10 +40,10 @@ Defs {
@11-14,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-42,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -49,10 +50,10 @@ Defs {
@16-35,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -11,10 +11,10 @@ Defs {
@0-69,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -34,10 +34,10 @@ Defs {
@15-57,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -67,10 +67,10 @@ Defs {
@31-43,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-114,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@39-101,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -84,10 +85,10 @@ Defs {
@82-91,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-143,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@56-119,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -112,10 +113,10 @@ Defs {
@76-83,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -181,10 +182,10 @@ Defs {
@92-99,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,19 +1,20 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@0-26,
@0-28,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -24,88 +25,90 @@ Defs {
@0-4 Identifier {
ident: "main",
},
@11-26 Defs(
@11-28 Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@15-26,
@16-27,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
value_defs: [
Body(
@15-26 Identifier {
@16-27 Identifier {
ident: "1",
},
@15-26 ParensAround(
@16-27 ParensAround(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@20-25,
@21-26,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
value_defs: [
Body(
@20-25 Identifier {
@21-26 Identifier {
ident: "0",
},
@20-25 Apply(
@22-23 Var {
module_name: "Num",
ident: "add",
},
[
@20-21 Num(
"1",
@21-26 ParensAround(
Apply(
@23-24 Var {
module_name: "Num",
ident: "add",
},
[
@21-22 Num(
"1",
),
@25-26 Num(
"1",
),
],
BinOp(
Plus,
),
@24-25 Num(
"1",
),
],
BinOp(
Plus,
),
),
),
],
},
@15-26 LowLevelDbg(
@16-27 LowLevelDbg(
(
"test.roc:3",
" ",
),
@20-25 Apply(
@20-25 Var {
@21-26 Apply(
@21-26 Var {
module_name: "Inspect",
ident: "toStr",
},
[
@20-25 Var {
@21-26 Var {
module_name: "",
ident: "0",
},
],
Space,
),
@20-25 Var {
@21-26 Var {
module_name: "",
ident: "0",
},
@ -115,25 +118,25 @@ Defs {
),
],
},
@11-26 LowLevelDbg(
@11-28 LowLevelDbg(
(
"test.roc:2",
"in =\n ",
"n =\n ",
),
@15-26 Apply(
@15-26 Var {
@16-27 Apply(
@16-27 Var {
module_name: "Inspect",
ident: "toStr",
},
[
@15-26 Var {
@16-27 Var {
module_name: "",
ident: "1",
},
],
Space,
),
@15-26 Var {
@16-27 Var {
module_name: "",
ident: "1",
},

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-49,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-24,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-99,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -12,12 +13,12 @@ Defs {
@56-98,
],
space_before: [
Slice { start: 0, length: 0 },
Slice { start: 0, length: 2 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 2 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice { start: 2, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 1 },
],
spaces: [
Newline,
@ -39,10 +40,10 @@ Defs {
@15-20,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -74,10 +75,10 @@ Defs {
@25-39,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -151,10 +152,10 @@ Defs {
@75-80,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-158,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -45,10 +46,10 @@ Defs {
@50-52,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-31,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@11-24,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-307,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -37,14 +38,14 @@ Defs {
@109-298,
],
space_before: [
Slice { start: 0, length: 0 },
Slice { start: 0, length: 1 },
Slice { start: 1, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 1, length: 1 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice { start: 1, length: 0 },
Slice { start: 2, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 1, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 0 },
],
spaces: [
Newline,
@ -171,10 +172,10 @@ Defs {
@140-152,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -293,10 +294,10 @@ Defs {
@227-239,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-189,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -35,12 +36,12 @@ Defs {
@52-70,
],
space_before: [
Slice { start: 0, length: 0 },
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice { start: 1, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 1, length: 0 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -14,14 +15,14 @@ Defs {
@229-266,
],
space_before: [
Slice { start: 0, length: 0 },
Slice { start: 0, length: 2 },
Slice { start: 2, length: 2 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 2 },
Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 2 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice { start: 2, length: 0 },
Slice { start: 4, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 4, length: 1 },
],
spaces: [
Newline,
@ -120,12 +121,12 @@ Defs {
@203-208,
],
space_before: [
Slice { start: 0, length: 0 },
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice { start: 1, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 1, length: 0 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -12,12 +13,12 @@ Defs {
@35-45,
],
space_before: [
Slice { start: 0, length: 0 },
Slice { start: 0, length: 2 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 2 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice { start: 2, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 2, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-26,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@15-17,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-33,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -39,10 +40,10 @@ Defs {
@11-14,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -99,10 +100,10 @@ Defs {
@20-23,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-26,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -11,10 +11,10 @@ Defs {
@0-72,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -40,10 +40,10 @@ Defs {
@11-23,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-51,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@17-24,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-24,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -39,10 +40,10 @@ Defs {
@11-16,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-61,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-49,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@23-42,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-22,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-51,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -33,10 +34,10 @@ Defs {
@11-40,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
@ -60,10 +61,10 @@ Defs {
@11-12,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -11,10 +11,10 @@ Defs {
@0-73,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -40,10 +40,10 @@ Defs {
@11-57,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-67,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -48,10 +49,10 @@ Defs {
@19-30,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-154,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-44,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -45,10 +46,10 @@ Defs {
@28-29,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-45,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-120,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,
@ -67,10 +68,10 @@ Defs {
@54-65,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],

View file

@ -1,6 +1,7 @@
---
source: crates/compiler/can/tests/test_suffixed.rs
expression: snapshot
snapshot_kind: text
---
Defs {
tags: [
@ -10,10 +11,10 @@ Defs {
@0-74,
],
space_before: [
Slice { start: 0, length: 0 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 1 },
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 1 },
],
spaces: [
Newline,

View file

@ -0,0 +1,13 @@
#[cfg(test)]
mod test_can_expr {
use roc_can::expr::Expr;
use test_compile::can_expr;
#[test]
fn test_can_unit() {
let output = can_expr("{}");
assert_eq!(output.problems, Vec::new());
assert!(matches!(output.expr, Expr::EmptyRecord));
}
}

View file

@ -464,7 +464,7 @@ mod suffixed_tests {
run_test!(
r#"
main =
dbg (dbg 1 + 1)
dbg (dbg (1 + 1))
"#
);
}