mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-13 15:26:24 +00:00
properly unify ingested file type variable
This commit is contained in:
parent
fdf8bc6094
commit
165ffcf38d
1 changed files with 28 additions and 7 deletions
|
@ -1785,7 +1785,12 @@ fn solve(
|
||||||
);
|
);
|
||||||
|
|
||||||
let snapshot = subs.snapshot();
|
let snapshot = subs.snapshot();
|
||||||
if let Success { .. } = unify(
|
if let Success {
|
||||||
|
vars,
|
||||||
|
must_implement_ability,
|
||||||
|
lambda_sets_to_specialize,
|
||||||
|
extra_metadata: _,
|
||||||
|
} = unify(
|
||||||
&mut UEnv::new(subs),
|
&mut UEnv::new(subs),
|
||||||
actual,
|
actual,
|
||||||
Variable::LIST_U8,
|
Variable::LIST_U8,
|
||||||
|
@ -1793,12 +1798,17 @@ fn solve(
|
||||||
Polarity::OF_VALUE,
|
Polarity::OF_VALUE,
|
||||||
) {
|
) {
|
||||||
// List U8 always valid.
|
// List U8 always valid.
|
||||||
subs.rollback_to(snapshot);
|
introduce(subs, rank, pools, &vars);
|
||||||
|
|
||||||
|
debug_assert!(
|
||||||
|
must_implement_ability.is_empty() && lambda_sets_to_specialize.is_empty(),
|
||||||
|
"List U8 will never need to implement abilities or specialize lambda sets"
|
||||||
|
);
|
||||||
|
|
||||||
state
|
state
|
||||||
} else {
|
} else {
|
||||||
subs.rollback_to(snapshot);
|
subs.rollback_to(snapshot);
|
||||||
|
|
||||||
let snapshot = subs.snapshot();
|
|
||||||
// We explicitly match on the last unify to get the type in the case it errors.
|
// We explicitly match on the last unify to get the type in the case it errors.
|
||||||
match unify(
|
match unify(
|
||||||
&mut UEnv::new(subs),
|
&mut UEnv::new(subs),
|
||||||
|
@ -1807,7 +1817,19 @@ fn solve(
|
||||||
Mode::EQ,
|
Mode::EQ,
|
||||||
Polarity::OF_VALUE,
|
Polarity::OF_VALUE,
|
||||||
) {
|
) {
|
||||||
Success { .. } => {
|
Success {
|
||||||
|
vars,
|
||||||
|
must_implement_ability,
|
||||||
|
lambda_sets_to_specialize,
|
||||||
|
extra_metadata: _,
|
||||||
|
} => {
|
||||||
|
introduce(subs, rank, pools, &vars);
|
||||||
|
|
||||||
|
debug_assert!(
|
||||||
|
must_implement_ability.is_empty() && lambda_sets_to_specialize.is_empty(),
|
||||||
|
"Str will never need to implement abilities or specialize lambda sets"
|
||||||
|
);
|
||||||
|
|
||||||
// Str only valid if valid utf8.
|
// Str only valid if valid utf8.
|
||||||
if let Err(err) = std::str::from_utf8(bytes) {
|
if let Err(err) = std::str::from_utf8(bytes) {
|
||||||
let problem =
|
let problem =
|
||||||
|
@ -1815,11 +1837,10 @@ fn solve(
|
||||||
problems.push(problem);
|
problems.push(problem);
|
||||||
}
|
}
|
||||||
|
|
||||||
subs.rollback_to(snapshot);
|
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
Failure(_, actual_type, _, _) => {
|
Failure(vars, actual_type, _, _) => {
|
||||||
subs.rollback_to(snapshot);
|
introduce(subs, rank, pools, &vars);
|
||||||
|
|
||||||
let problem = TypeError::IngestedFileUnsupportedType(
|
let problem = TypeError::IngestedFileUnsupportedType(
|
||||||
file_path.clone(),
|
file_path.clone(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue