diff --git a/ast/src/constrain.rs b/ast/src/constrain.rs index 2fcc3de67c..19ea3a2c3d 100644 --- a/ast/src/constrain.rs +++ b/ast/src/constrain.rs @@ -6,7 +6,7 @@ use roc_module::{ ident::{Lowercase, TagName}, symbol::Symbol, }; -use roc_region::all::{Located, Region}; +use roc_region::all::Region; use roc_types::{ subs::Variable, types::{self, AnnotationSource, PReason, PatternCategory}, @@ -32,9 +32,9 @@ use crate::{ #[derive(Debug)] pub enum Constraint<'a> { - Eq(Type2, Expected, Category, Region), + Eq(Type2, Expected, Category, Region), // Store(Type, Variable, &'static str, u32), - Lookup(Symbol, Expected, Region), + Lookup(Symbol, Expected, Region), Pattern(Region, PatternCategory, Type2, PExpected), And(BumpVec<'a, Constraint<'a>>), Let(&'a LetConstraint<'a>), @@ -55,7 +55,7 @@ pub fn constrain_expr<'a>( arena: &'a Bump, env: &mut Env, expr: &Expr2, - expected: Expected, + expected: Expected, region: Region, ) -> Constraint<'a> { use Constraint::*; @@ -528,10 +528,7 @@ pub fn constrain_expr<'a>( AnnotationSource::TypedIfBranch { index: Index::zero_based(index), num_branches, - annotation: Located::at( - ann_source.region(), - ann_source.annotation().value, - ), + region: ann_source.region(), }, tipe.shallow_clone(), ), @@ -552,10 +549,7 @@ pub fn constrain_expr<'a>( AnnotationSource::TypedIfBranch { index: Index::zero_based(branches.len()), num_branches, - annotation: Located::at( - ann_source.region(), - ann_source.annotation().value, - ), + region: ann_source.region(), }, tipe.shallow_clone(), ), @@ -695,10 +689,7 @@ pub fn constrain_expr<'a>( *arity, AnnotationSource::TypedWhenBranch { index: Index::zero_based(index), - annotation: Located::at( - ann_source.region(), - ann_source.annotation().value, - ), + region: ann_source.region(), }, typ.shallow_clone(), ), @@ -1185,7 +1176,7 @@ fn exists<'a>( fn constrain_tag<'a>( arena: &'a Bump, env: &mut Env, - expected: Expected, + expected: Expected, region: Region, tag_name: TagName, arguments: &PoolVec<(Variable, ExprId)>, @@ -1275,10 +1266,7 @@ fn constrain_field_update<'a>( (field_type, con) } -fn constrain_empty_record<'a>( - expected: Expected, - region: Region, -) -> Constraint<'a> { +fn constrain_empty_record<'a>(expected: Expected, region: Region) -> Constraint<'a> { Constraint::Eq(Type2::EmptyRec, expected, Category::Record, region) } @@ -1289,7 +1277,7 @@ fn constrain_when_branch<'a>( region: Region, when_branch: &WhenBranch, pattern_expected: PExpected, - expr_expected: Expected, + expr_expected: Expected, ) -> Constraint<'a> { let when_expr = env.pool.get(when_branch.body); diff --git a/ast/src/mem_pool/shallow_clone.rs b/ast/src/mem_pool/shallow_clone.rs index 485693a6ec..7bcd6b46e3 100644 --- a/ast/src/mem_pool/shallow_clone.rs +++ b/ast/src/mem_pool/shallow_clone.rs @@ -6,10 +6,9 @@ pub trait ShallowClone { fn shallow_clone(&self) -> Self; } -impl ShallowClone for Expected +impl ShallowClone for Expected where T: ShallowClone, - Annot: Clone, { fn shallow_clone(&self) -> Self { use Expected::*; @@ -18,7 +17,7 @@ where NoExpectation(t) => NoExpectation(t.shallow_clone()), ForReason(reason, t, region) => ForReason(reason.clone(), t.shallow_clone(), *region), FromAnnotation(loc_pat, n, source, t) => { - FromAnnotation(loc_pat.clone(), *n, source.clone(), t.shallow_clone()) + FromAnnotation(loc_pat.clone(), *n, *source, t.shallow_clone()) } } } diff --git a/ast/src/solve_type.rs b/ast/src/solve_type.rs index 7627d86f92..ce63419a56 100644 --- a/ast/src/solve_type.rs +++ b/ast/src/solve_type.rs @@ -75,7 +75,7 @@ use crate::mem_pool::shallow_clone::ShallowClone; #[derive(PartialEq, Debug, Clone)] pub enum TypeError { - BadExpr(Region, Category, ErrorType, Expected), + BadExpr(Region, Category, ErrorType, Expected), BadPattern(Region, PatternCategory, ErrorType, PExpected), CircularType(Region, Symbol, ErrorType), BadType(roc_types::types::Problem), diff --git a/compiler/can/src/builtins.rs b/compiler/can/src/builtins.rs index 139bdd9e0e..d2ce526f1b 100644 --- a/compiler/can/src/builtins.rs +++ b/compiler/can/src/builtins.rs @@ -1204,7 +1204,6 @@ fn num_max_i128(symbol: Symbol, var_store: &mut VarStore) -> Def { let annotation = crate::def::Annotation { signature, - annotation_var: var_store.fresh(), introduced_variables: Default::default(), region: Region::zero(), aliases: Default::default(), diff --git a/compiler/can/src/constraint.rs b/compiler/can/src/constraint.rs index 4f351f34e1..a300d48ea8 100644 --- a/compiler/can/src/constraint.rs +++ b/compiler/can/src/constraint.rs @@ -7,9 +7,9 @@ use roc_types::{subs::Variable, types::VariableDetail}; #[derive(Debug, Clone, PartialEq)] pub enum Constraint { - Eq(Type, Expected, Category, Region), + Eq(Type, Expected, Category, Region), Store(Type, Variable, &'static str, u32), - Lookup(Symbol, Expected, Region), + Lookup(Symbol, Expected, Region), Pattern(Region, PatternCategory, Type, PExpected), True, // Used for things that always unify, e.g. blanks and runtime errors SaveTheEnvironment, diff --git a/compiler/can/src/def.rs b/compiler/can/src/def.rs index 6fcc09c0db..76bc58ae4e 100644 --- a/compiler/can/src/def.rs +++ b/compiler/can/src/def.rs @@ -35,7 +35,6 @@ pub struct Def { #[derive(Clone, Debug, PartialEq)] pub struct Annotation { pub signature: Type, - pub annotation_var: Variable, pub introduced_variables: IntroducedVariables, pub aliases: SendMap, pub region: Region, @@ -876,7 +875,6 @@ fn canonicalize_pending_def<'a>( pattern_vars: vars_by_symbol.clone(), annotation: Some(Annotation { signature: typ.clone(), - annotation_var: var_store.fresh(), introduced_variables: output.introduced_variables.clone(), aliases: ann.aliases.clone(), region: loc_ann.region, @@ -1098,7 +1096,6 @@ fn canonicalize_pending_def<'a>( pattern_vars: vars_by_symbol.clone(), annotation: Some(Annotation { signature: typ.clone(), - annotation_var: var_store.fresh(), introduced_variables: output.introduced_variables.clone(), aliases: ann.aliases.clone(), region: loc_ann.region, diff --git a/compiler/can/src/expected.rs b/compiler/can/src/expected.rs index dd67dd4d0c..fc9b0e37de 100644 --- a/compiler/can/src/expected.rs +++ b/compiler/can/src/expected.rs @@ -3,9 +3,9 @@ use roc_region::all::{Located, Region}; use roc_types::types::{AnnotationSource, PReason, Reason}; #[derive(Debug, Clone, PartialEq)] -pub enum Expected { +pub enum Expected { NoExpectation(T), - FromAnnotation(Located, usize, AnnotationSource, T), + FromAnnotation(Located, usize, AnnotationSource, T), ForReason(Reason, T, Region), } @@ -46,7 +46,7 @@ impl PExpected { } } -impl Expected { +impl Expected { pub fn get_type(self) -> T { match self { Expected::NoExpectation(val) => val, @@ -73,12 +73,14 @@ impl Expected { pub fn get_annotation_region(&self) -> Option { match self { - Expected::FromAnnotation(_, _, ann_source, _) => Some(ann_source.region()), + Expected::FromAnnotation(_, _, AnnotationSource::TypedBody { region }, _) => { + Some(*region) + } _ => None, } } - pub fn replace(self, new: U) -> Expected { + pub fn replace(self, new: U) -> Expected { match self { Expected::NoExpectation(_val) => Expected::NoExpectation(new), Expected::ForReason(reason, _val, region) => Expected::ForReason(reason, new, region), @@ -88,34 +90,15 @@ impl Expected { } } - pub fn replace_ref(&self, new: U) -> Expected - where - Annot: Clone, - { + pub fn replace_ref(&self, new: U) -> Expected { match self { Expected::NoExpectation(_val) => Expected::NoExpectation(new), Expected::ForReason(reason, _val, region) => { Expected::ForReason(reason.clone(), new, *region) } Expected::FromAnnotation(pattern, size, source, _val) => { - Expected::FromAnnotation(pattern.clone(), *size, source.clone(), new) + Expected::FromAnnotation(pattern.clone(), *size, *source, new) } } } - - pub fn replace_annotation_with(self, create_new_annotation: F) -> Expected - where - F: FnOnce(Annot) -> Annot2, - { - match self { - Expected::NoExpectation(val) => Expected::NoExpectation(val), - Expected::ForReason(reason, val, region) => Expected::ForReason(reason, val, region), - Expected::FromAnnotation(pattern, size, ann_source, val) => Expected::FromAnnotation( - pattern, - size, - ann_source.replace_with(create_new_annotation), - val, - ), - } - } } diff --git a/compiler/constrain/src/builtins.rs b/compiler/constrain/src/builtins.rs index 88b46dff65..c47a1e5796 100644 --- a/compiler/constrain/src/builtins.rs +++ b/compiler/constrain/src/builtins.rs @@ -14,7 +14,7 @@ use roc_types::types::Type::{self, *}; pub fn int_literal( num_var: Variable, precision_var: Variable, - expected: Expected, + expected: Expected, region: Region, ) -> Constraint { let num_type = Variable(num_var); @@ -38,7 +38,7 @@ pub fn int_literal( pub fn float_literal( num_var: Variable, precision_var: Variable, - expected: Expected, + expected: Expected, region: Region, ) -> Constraint { let num_type = Variable(num_var); diff --git a/compiler/constrain/src/expr.rs b/compiler/constrain/src/expr.rs index 64c83172d9..add695866e 100644 --- a/compiler/constrain/src/expr.rs +++ b/compiler/constrain/src/expr.rs @@ -93,7 +93,7 @@ pub fn constrain_expr( env: &Env, region: Region, expr: &Expr, - expected: Expected, + expected: Expected, ) -> Constraint { match expr { Int(var, precision, _, _) => int_literal(*var, *precision, expected, region), @@ -468,7 +468,7 @@ pub fn constrain_expr( AnnotationSource::TypedIfBranch { index: Index::zero_based(index), num_branches, - annotation: *ann_source.annotation(), + region: ann_source.region(), }, tipe.clone(), ), @@ -488,7 +488,7 @@ pub fn constrain_expr( AnnotationSource::TypedIfBranch { index: Index::zero_based(branches.len()), num_branches, - annotation: *ann_source.annotation(), + region: ann_source.region(), }, tipe.clone(), ), @@ -606,7 +606,7 @@ pub fn constrain_expr( *arity, TypedWhenBranch { index: Index::zero_based(index), - annotation: *ann_source.annotation(), + region: ann_source.region(), }, typ.clone(), ), @@ -1021,7 +1021,7 @@ fn constrain_when_branch( region: Region, when_branch: &WhenBranch, pattern_expected: PExpected, - expr_expected: Expected, + expr_expected: Expected, ) -> Constraint { let ret_constraint = constrain_expr(env, region, &when_branch.value.value, expr_expected); @@ -1089,7 +1089,7 @@ fn constrain_field(env: &Env, field_var: Variable, loc_expr: &Located) -> } #[inline(always)] -fn constrain_empty_record(region: Region, expected: Expected) -> Constraint { +fn constrain_empty_record(region: Region, expected: Expected) -> Constraint { Eq(EmptyRec, expected, Category::Record, region) } @@ -1182,15 +1182,15 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint { rigids: ftv, }; - let annotation_ty = Located::at(annotation.region, annotation.annotation_var); let annotation_expected = FromAnnotation( def.loc_pattern.clone(), arity, AnnotationSource::TypedBody { - annotation: annotation_ty, + region: annotation.region, }, signature.clone(), ); + def_pattern_state.constraints.push(Eq( expr_type, annotation_expected.clone(), @@ -1198,16 +1198,6 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint { Region::span_across(&annotation.region, &def.loc_expr.region), )); - // Associate the original annotation type itself with an annotation variable, - // so we can get it back out later during error reporting if needed. This avoids - // passing down the bulky annotation type to everyone who cares about it. - def_pattern_state.constraints.push(Store( - annotation.signature.clone(), - annotation.annotation_var, - std::file!(), - std::line!(), - )); - // when a def is annotated, and it's body is a closure, treat this // as a named function (in elm terms) for error messages. // @@ -1310,7 +1300,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint { def.loc_pattern.clone(), arguments.len(), AnnotationSource::TypedBody { - annotation: annotation_ty, + region: annotation.region, }, ret_type.clone(), ); @@ -1337,7 +1327,7 @@ fn constrain_def(env: &Env, def: &Def, body_con: Constraint) -> Constraint { def.loc_pattern.clone(), arity, AnnotationSource::TypedBody { - annotation: annotation_ty, + region: annotation.region, }, *signature_closure_type.clone(), ), @@ -1569,19 +1559,10 @@ pub fn rec_defs_help( def.loc_pattern.clone(), arity, AnnotationSource::TypedBody { - annotation: Located::at(annotation.region, annotation.annotation_var), + region: annotation.region, }, signature.clone(), ); - // Associate the original annotation type itself with an annotation variable, - // so we can get it back out later during error reporting if needed. This avoids - // passing down the bulky annotation type to everyone who cares about it. - let annotation_constr = Store( - annotation.signature.clone(), - annotation.annotation_var, - std::file!(), - std::line!(), - ); // when a def is annotated, and it's body is a closure, treat this // as a named function (in elm terms) for error messages. @@ -1714,7 +1695,6 @@ pub fn rec_defs_help( Store(signature, expr_var, std::file!(), std::line!()), Store(ret_type, ret_var, std::file!(), std::line!()), closure_constraint, - annotation_constr, ]), ); @@ -1745,7 +1725,6 @@ pub fn rec_defs_help( })), // Store type into AST vars. We use Store so errors aren't reported twice Store(signature, expr_var, std::file!(), std::line!()), - annotation_constr, ]); rigid_info.vars.extend(&new_rigids); diff --git a/compiler/load/src/effect_module.rs b/compiler/load/src/effect_module.rs index 10f07b5307..24f46cda44 100644 --- a/compiler/load/src/effect_module.rs +++ b/compiler/load/src/effect_module.rs @@ -191,7 +191,6 @@ fn build_effect_always( let def_annotation = roc_can::def::Annotation { signature, introduced_variables, - annotation_var: var_store.fresh(), aliases: SendMap::default(), region: Region::zero(), }; @@ -404,7 +403,6 @@ fn build_effect_map( let def_annotation = roc_can::def::Annotation { signature, introduced_variables, - annotation_var: var_store.fresh(), aliases: SendMap::default(), region: Region::zero(), }; @@ -572,7 +570,6 @@ fn build_effect_after( let def_annotation = roc_can::def::Annotation { signature, introduced_variables, - annotation_var: var_store.fresh(), aliases: SendMap::default(), region: Region::zero(), }; @@ -745,7 +742,6 @@ pub fn build_host_exposed_def( let def_annotation = roc_can::def::Annotation { signature: annotation.typ, introduced_variables: annotation.introduced_variables, - annotation_var: var_store.fresh(), aliases: annotation.aliases, region: Region::zero(), }; diff --git a/compiler/region/src/all.rs b/compiler/region/src/all.rs index 54780eb269..90c05be8b1 100644 --- a/compiler/region/src/all.rs +++ b/compiler/region/src/all.rs @@ -211,16 +211,6 @@ impl Located { value: transform(&self.value), } } - - pub fn map_in_place(self, transform: F) -> Located - where - F: (FnOnce(T) -> U), - { - Located { - region: self.region, - value: transform(self.value), - } - } } impl fmt::Debug for Located diff --git a/compiler/solve/src/solve.rs b/compiler/solve/src/solve.rs index 4db43b6a7a..3e1001ebe5 100644 --- a/compiler/solve/src/solve.rs +++ b/compiler/solve/src/solve.rs @@ -11,7 +11,7 @@ use roc_types::subs::{ }; use roc_types::types::Type::{self, *}; use roc_types::types::{gather_fields_unsorted_iter, Alias, Category, ErrorType, PatternCategory}; -use roc_unify::unify::{unify, unify_without_error_compaction, Unified::*}; +use roc_unify::unify::{unify, Unified::*}; use std::collections::hash_map::Entry; // Type checking system adapted from Elm by Evan Czaplicki, BSD-3-Clause Licensed @@ -66,7 +66,7 @@ use std::collections::hash_map::Entry; #[derive(PartialEq, Debug, Clone)] pub enum TypeError { - BadExpr(Region, Category, ErrorType, Expected), + BadExpr(Region, Category, ErrorType, Expected), BadPattern(Region, PatternCategory, ErrorType, PExpected), CircularType(Region, Symbol, ErrorType), BadType(roc_types::types::Problem), @@ -205,9 +205,7 @@ fn solve( expectation.get_type_ref(), ); - // Don't transform bad types into errors in case we want to grab other types' - // original contents during a failure. - match unify_without_error_compaction(subs, actual, expected) { + match unify(subs, actual, expected) { Success(vars) => { introduce(subs, rank, pools, &vars); @@ -220,12 +218,7 @@ fn solve( *region, category.clone(), actual_type, - expectation - .clone() - .replace(expected_type) - .replace_annotation_with(|annot_var: Variable| { - subs.var_to_error_type(annot_var).0 - }), + expectation.clone().replace(expected_type), ); problems.push(problem); @@ -301,9 +294,7 @@ fn solve( cached_aliases, expectation.get_type_ref(), ); - // Don't transform bad types into errors in case we want to grab other types' - // original contents during a failure. - match unify_without_error_compaction(subs, actual, expected) { + match unify(subs, actual, expected) { Success(vars) => { introduce(subs, rank, pools, &vars); @@ -317,12 +308,7 @@ fn solve( *region, Category::Lookup(*symbol), actual_type, - expectation - .clone() - .replace(expected_type) - .replace_annotation_with(|annot_var: Variable| { - subs.var_to_error_type(annot_var).0 - }), + expectation.clone().replace(expected_type), ); problems.push(problem); diff --git a/compiler/types/src/types.rs b/compiler/types/src/types.rs index 43dab31779..73c4608bef 100644 --- a/compiler/types/src/types.rs +++ b/compiler/types/src/types.rs @@ -1107,61 +1107,28 @@ pub enum PReason { OptionalField, } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum AnnotationSource { +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum AnnotationSource { TypedIfBranch { index: Index, num_branches: usize, - annotation: Located, + region: Region, }, TypedWhenBranch { index: Index, - annotation: Located, + region: Region, }, TypedBody { - annotation: Located, + region: Region, }, } -impl AnnotationSource { +impl AnnotationSource { pub fn region(&self) -> Region { match self { - Self::TypedIfBranch { annotation, .. } - | Self::TypedWhenBranch { annotation, .. } - | Self::TypedBody { annotation, .. } => annotation.region, - } - } - - pub fn annotation(&self) -> &Located { - match self { - Self::TypedIfBranch { annotation, .. } - | Self::TypedWhenBranch { annotation, .. } - | Self::TypedBody { annotation, .. } => annotation, - } - } - - pub fn replace_with(self, create_new_annotation: F) -> AnnotationSource - where - F: FnOnce(Annot) -> Annot2, - { - use AnnotationSource::*; - match self { - TypedIfBranch { - index, - num_branches, - annotation, - } => TypedIfBranch { - index, - num_branches, - annotation: annotation.map_in_place(create_new_annotation), - }, - TypedWhenBranch { index, annotation } => TypedWhenBranch { - index, - annotation: annotation.map_in_place(create_new_annotation), - }, - TypedBody { annotation } => TypedBody { - annotation: annotation.map_in_place(create_new_annotation), - }, + &Self::TypedIfBranch { region, .. } + | &Self::TypedWhenBranch { region, .. } + | &Self::TypedBody { region, .. } => region, } } } diff --git a/compiler/unify/src/unify.rs b/compiler/unify/src/unify.rs index 9470fa9c99..ff8f51966e 100644 --- a/compiler/unify/src/unify.rs +++ b/compiler/unify/src/unify.rs @@ -82,16 +82,6 @@ type Outcome = Vec; #[inline(always)] pub fn unify(subs: &mut Subs, var1: Variable, var2: Variable) -> Unified { - unify_help(subs, var1, var2, true) -} - -#[inline(always)] -pub fn unify_without_error_compaction(subs: &mut Subs, var1: Variable, var2: Variable) -> Unified { - unify_help(subs, var1, var2, false) -} - -#[inline(always)] -fn unify_help(subs: &mut Subs, var1: Variable, var2: Variable, compact_errors: bool) -> Unified { let mut vars = Vec::new(); let mismatches = unify_pool(subs, &mut vars, var1, var2); @@ -103,9 +93,7 @@ fn unify_help(subs: &mut Subs, var1: Variable, var2: Variable, compact_errors: b problems.extend(problems2); - if compact_errors { - subs.union(var1, var2, Content::Error.into()); - } + subs.union(var1, var2, Content::Error.into()); if !problems.is_empty() { Unified::BadType(vars, problems.remove(0)) diff --git a/reporting/src/error/type.rs b/reporting/src/error/type.rs index 9e8d94a214..ff9daba56c 100644 --- a/reporting/src/error/type.rs +++ b/reporting/src/error/type.rs @@ -6,9 +6,7 @@ use roc_module::symbol::Symbol; use roc_region::all::{Located, Region}; use roc_solve::solve; use roc_types::pretty_print::{Parens, WILDCARD}; -use roc_types::types::{ - name_type_var, Category, ErrorType, PatternCategory, Reason, RecordField, TypeExt, -}; +use roc_types::types::{Category, ErrorType, PatternCategory, Reason, RecordField, TypeExt}; use std::path::PathBuf; use crate::internal_error; @@ -291,7 +289,7 @@ fn to_expr_report<'b>( expr_region: roc_region::all::Region, category: Category, found: ErrorType, - expected: Expected, + expected: Expected, ) -> Report<'b> { match expected { Expected::NoExpectation(expected_type) => { @@ -371,7 +369,6 @@ fn to_expr_report<'b>( let expectation_context = ExpectationContext::Annotation { on: on_name_text.clone(), - signature: annotation_source.annotation().value.clone(), }; let comparison = if diff_is_wildcard_comparison( @@ -953,10 +950,7 @@ fn count_arguments(tipe: &ErrorType) -> usize { enum ExpectationContext<'a> { /// An expected type was discovered from a type annotation. Corresponds to /// [`Expected::FromAnnotation`](Expected::FromAnnotation). - Annotation { - on: RocDocBuilder<'a>, - signature: ErrorType, - }, + Annotation { on: RocDocBuilder<'a> }, /// When we don't know the context, or it's not relevant. Arbitrary, } @@ -2698,7 +2692,7 @@ fn type_problem_to_pretty<'b>( alloc.tip().append(line) } - (BadRigidVar(x, tipe), ExpectationContext::Annotation { on, signature }) => { + (BadRigidVar(x, tipe), ExpectationContext::Annotation { on }) => { use ErrorType::*; let bad_rigid_var = |name: Lowercase, a_thing| { @@ -2712,10 +2706,6 @@ fn type_problem_to_pretty<'b>( }; let bad_double_wildcard = || { - let mut taken_names = MutSet::default(); - signature.add_names(&mut taken_names); - let (named_var_suggest, _) = name_type_var(0, &mut taken_names); - alloc.tip().append(alloc.concat(vec![ alloc.reflow( "Any connection between types must use a named type variable, not a ", @@ -2723,9 +2713,7 @@ fn type_problem_to_pretty<'b>( alloc.type_variable(WILDCARD.into()), alloc.reflow("! Maybe the annotation "), on, - alloc.reflow(" should have a named type variable, like "), - alloc.type_variable(named_var_suggest), - alloc.reflow(" in place of the "), + alloc.reflow(" should have a named type variable in place of the "), alloc.type_variable(WILDCARD.into()), alloc.reflow("?"), ])) diff --git a/reporting/tests/test_reporting.rs b/reporting/tests/test_reporting.rs index f71c554019..735861ebb3 100644 --- a/reporting/tests/test_reporting.rs +++ b/reporting/tests/test_reporting.rs @@ -6797,8 +6797,8 @@ I need all branches in an `if` to have the same type! way that isn't reflected in this annotation. Tip: Any connection between types must use a named type variable, not - a `*`! Maybe the annotation on `f` should have a named type variable, - like `b` in place of the `*`? + a `*`! Maybe the annotation on `f` should have a named type variable in + place of the `*`? "# ), ) @@ -6834,8 +6834,8 @@ I need all branches in an `if` to have the same type! in a way that isn't reflected in this annotation. Tip: Any connection between types must use a named type variable, not - a `*`! Maybe the annotation on `f` should have a named type variable, - like `c` in place of the `*`? + a `*`! Maybe the annotation on `f` should have a named type variable in + place of the `*`? "# ), ) @@ -6876,8 +6876,8 @@ I need all branches in an `if` to have the same type! way that isn't reflected in this annotation. Tip: Any connection between types must use a named type variable, not - a `*`! Maybe the annotation on `f` should have a named type variable, - like `c` in place of the `*`? + a `*`! Maybe the annotation on `f` should have a named type variable in + place of the `*`? "# ), )