Revert "Include annotation type signatures in Expected struct"

This reverts commit 6e4fd5f06a1ae6138659b0073b4e2b375a499588.

This idea didn't work out because cloning the type and storing it on a
variable still resulted in the solver trying to uify the variable with
the type. When there were errors, which there certainly would be if we
tried to unify the variable with a structure that had nested flex/rigid
vars, the nested flex/rigid vars would inherit those errors, and the
program wouldn't typecheck.

Since the motivation here was to expose the signature type to
`reporting` so that we could modify it with suggestions, we should
instead pass that information along in something analogous to the
`Expected` struct.
This commit is contained in:
ayazhafiz 2021-11-25 13:08:18 -05:00
parent a8e38172ac
commit d352d2cdf8
16 changed files with 64 additions and 204 deletions

View file

@ -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<Type2, Variable>, Category, Region),
Eq(Type2, Expected<Type2>, Category, Region),
// Store(Type, Variable, &'static str, u32),
Lookup(Symbol, Expected<Type2, Variable>, Region),
Lookup(Symbol, Expected<Type2>, Region),
Pattern(Region, PatternCategory, Type2, PExpected<Type2>),
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<Type2, Variable>,
expected: Expected<Type2>,
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<Type2, Variable>,
expected: Expected<Type2>,
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<Type2, Variable>,
region: Region,
) -> Constraint<'a> {
fn constrain_empty_record<'a>(expected: Expected<Type2>, 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<Type2>,
expr_expected: Expected<Type2, Variable>,
expr_expected: Expected<Type2>,
) -> Constraint<'a> {
let when_expr = env.pool.get(when_branch.body);

View file

@ -6,10 +6,9 @@ pub trait ShallowClone {
fn shallow_clone(&self) -> Self;
}
impl<T, Annot> ShallowClone for Expected<T, Annot>
impl<T> ShallowClone for Expected<T>
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())
}
}
}

View file

@ -75,7 +75,7 @@ use crate::mem_pool::shallow_clone::ShallowClone;
#[derive(PartialEq, Debug, Clone)]
pub enum TypeError {
BadExpr(Region, Category, ErrorType, Expected<ErrorType, Variable>),
BadExpr(Region, Category, ErrorType, Expected<ErrorType>),
BadPattern(Region, PatternCategory, ErrorType, PExpected<ErrorType>),
CircularType(Region, Symbol, ErrorType),
BadType(roc_types::types::Problem),

View file

@ -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(),

View file

@ -7,9 +7,9 @@ use roc_types::{subs::Variable, types::VariableDetail};
#[derive(Debug, Clone, PartialEq)]
pub enum Constraint {
Eq(Type, Expected<Type, Variable>, Category, Region),
Eq(Type, Expected<Type>, Category, Region),
Store(Type, Variable, &'static str, u32),
Lookup(Symbol, Expected<Type, Variable>, Region),
Lookup(Symbol, Expected<Type>, Region),
Pattern(Region, PatternCategory, Type, PExpected<Type>),
True, // Used for things that always unify, e.g. blanks and runtime errors
SaveTheEnvironment,

View file

@ -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<Symbol, Alias>,
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,

View file

@ -3,9 +3,9 @@ use roc_region::all::{Located, Region};
use roc_types::types::{AnnotationSource, PReason, Reason};
#[derive(Debug, Clone, PartialEq)]
pub enum Expected<T, Annot> {
pub enum Expected<T> {
NoExpectation(T),
FromAnnotation(Located<Pattern>, usize, AnnotationSource<Annot>, T),
FromAnnotation(Located<Pattern>, usize, AnnotationSource, T),
ForReason(Reason, T, Region),
}
@ -46,7 +46,7 @@ impl<T> PExpected<T> {
}
}
impl<T, Annot> Expected<T, Annot> {
impl<T> Expected<T> {
pub fn get_type(self) -> T {
match self {
Expected::NoExpectation(val) => val,
@ -73,12 +73,14 @@ impl<T, Annot> Expected<T, Annot> {
pub fn get_annotation_region(&self) -> Option<Region> {
match self {
Expected::FromAnnotation(_, _, ann_source, _) => Some(ann_source.region()),
Expected::FromAnnotation(_, _, AnnotationSource::TypedBody { region }, _) => {
Some(*region)
}
_ => None,
}
}
pub fn replace<U>(self, new: U) -> Expected<U, Annot> {
pub fn replace<U>(self, new: U) -> Expected<U> {
match self {
Expected::NoExpectation(_val) => Expected::NoExpectation(new),
Expected::ForReason(reason, _val, region) => Expected::ForReason(reason, new, region),
@ -88,34 +90,15 @@ impl<T, Annot> Expected<T, Annot> {
}
}
pub fn replace_ref<U>(&self, new: U) -> Expected<U, Annot>
where
Annot: Clone,
{
pub fn replace_ref<U>(&self, new: U) -> Expected<U> {
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<Annot2, F>(self, create_new_annotation: F) -> Expected<T, Annot2>
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,
),
}
}
}

View file

@ -14,7 +14,7 @@ use roc_types::types::Type::{self, *};
pub fn int_literal(
num_var: Variable,
precision_var: Variable,
expected: Expected<Type, Variable>,
expected: Expected<Type>,
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<Type, Variable>,
expected: Expected<Type>,
region: Region,
) -> Constraint {
let num_type = Variable(num_var);

View file

@ -93,7 +93,7 @@ pub fn constrain_expr(
env: &Env,
region: Region,
expr: &Expr,
expected: Expected<Type, Variable>,
expected: Expected<Type>,
) -> 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<Type>,
expr_expected: Expected<Type, Variable>,
expr_expected: Expected<Type>,
) -> 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<Expr>) ->
}
#[inline(always)]
fn constrain_empty_record(region: Region, expected: Expected<Type, Variable>) -> Constraint {
fn constrain_empty_record(region: Region, expected: Expected<Type>) -> 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);

View file

@ -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(),
};

View file

@ -211,16 +211,6 @@ impl<T> Located<T> {
value: transform(&self.value),
}
}
pub fn map_in_place<U, F>(self, transform: F) -> Located<U>
where
F: (FnOnce(T) -> U),
{
Located {
region: self.region,
value: transform(self.value),
}
}
}
impl<T> fmt::Debug for Located<T>

View file

@ -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<ErrorType, ErrorType>),
BadExpr(Region, Category, ErrorType, Expected<ErrorType>),
BadPattern(Region, PatternCategory, ErrorType, PExpected<ErrorType>),
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);

View file

@ -1107,61 +1107,28 @@ pub enum PReason {
OptionalField,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum AnnotationSource<Annot> {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AnnotationSource {
TypedIfBranch {
index: Index,
num_branches: usize,
annotation: Located<Annot>,
region: Region,
},
TypedWhenBranch {
index: Index,
annotation: Located<Annot>,
region: Region,
},
TypedBody {
annotation: Located<Annot>,
region: Region,
},
}
impl<Annot> AnnotationSource<Annot> {
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<Annot> {
match self {
Self::TypedIfBranch { annotation, .. }
| Self::TypedWhenBranch { annotation, .. }
| Self::TypedBody { annotation, .. } => annotation,
}
}
pub fn replace_with<Annot2, F>(self, create_new_annotation: F) -> AnnotationSource<Annot2>
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,
}
}
}

View file

@ -82,16 +82,6 @@ type Outcome = Vec<Mismatch>;
#[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());
}
if !problems.is_empty() {
Unified::BadType(vars, problems.remove(0))

View file

@ -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<ErrorType, ErrorType>,
expected: Expected<ErrorType>,
) -> 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("?"),
]))

View file

@ -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 `*`?
"#
),
)