mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-26 07:53:48 +00:00
switch from type annotation to type variable
This commit is contained in:
parent
8f4945f286
commit
6302a8d4b5
11 changed files with 136 additions and 97 deletions
|
@ -1771,6 +1771,55 @@ fn solve(
|
|||
|
||||
state
|
||||
}
|
||||
IngestedFile(type_index, _, bytes) => {
|
||||
let actual = either_type_index_to_var(
|
||||
subs,
|
||||
rank,
|
||||
pools,
|
||||
problems,
|
||||
abilities_store,
|
||||
obligation_cache,
|
||||
&mut can_types,
|
||||
aliases,
|
||||
*type_index,
|
||||
);
|
||||
|
||||
if let Success { .. } = unify(
|
||||
&mut UEnv::new(subs),
|
||||
actual,
|
||||
Variable::LIST_U8,
|
||||
Mode::EQ,
|
||||
Polarity::OF_VALUE,
|
||||
) {
|
||||
// List U8 always valid.
|
||||
state
|
||||
} else if let Success { .. } = unify(
|
||||
&mut UEnv::new(subs),
|
||||
actual,
|
||||
Variable::STR,
|
||||
Mode::EQ,
|
||||
Polarity::OF_VALUE,
|
||||
) {
|
||||
// Str only valid if valid utf8.
|
||||
if std::str::from_utf8(bytes).is_err() {
|
||||
todo!("add type error due to not being a utf8 string");
|
||||
}
|
||||
|
||||
state
|
||||
} else {
|
||||
// Unexpected type.
|
||||
todo!("Add type error for unsupported ingested file type");
|
||||
// let problem = TypeError::BadExpr(
|
||||
// *region,
|
||||
// Category::Lookup(*symbol),
|
||||
// actual_type,
|
||||
// expectation.replace_ref(expected_type),
|
||||
// );
|
||||
|
||||
// problems.push(problem);
|
||||
// state
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue