Fix typecheck error

This commit is contained in:
Ayaz Hafiz 2022-04-08 08:54:31 -04:00
parent 94a5cd3559
commit b3aee4ba7c
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58
2 changed files with 6 additions and 2 deletions

View File

@ -18,7 +18,7 @@ use roc_module::ident::Lowercase;
use roc_module::symbol::Symbol;
use roc_parse::ast::{self, TypeDef, TypeHeader, ValueDef as AstValueDef};
use roc_parse::pattern::PatternType;
use roc_problem::can::{Problem, RuntimeError};
use roc_problem::can::{Problem, RuntimeError, ShadowKind};
use roc_region::all::{Loc, Region};
use roc_types::subs::{VarStore, Variable};
use std::collections::HashMap;
@ -254,6 +254,7 @@ fn to_pending_def<'a>(
env.problem(Problem::Shadowing {
original_region,
shadow: loc_shadowed_symbol,
kind: ShadowKind::Variable,
});
Some((Output::default(), PendingDef::InvalidAlias))

View File

@ -12,7 +12,7 @@ use roc_error_macros::todo_opaques;
use roc_module::symbol::{Interns, Symbol};
use roc_parse::ast::{StrLiteral, StrSegment};
use roc_parse::pattern::PatternType;
use roc_problem::can::{MalformedPatternProblem, Problem, RuntimeError};
use roc_problem::can::{MalformedPatternProblem, Problem, RuntimeError, ShadowKind};
use roc_region::all::Region;
use roc_types::subs::Variable;
@ -161,6 +161,7 @@ pub fn to_pattern2<'a>(
env.problem(Problem::RuntimeError(RuntimeError::Shadowing {
original_region,
shadow: shadow.clone(),
kind: ShadowKind::Variable,
}));
let name: &str = shadow.value.as_ref();
@ -364,6 +365,7 @@ pub fn to_pattern2<'a>(
env.problem(Problem::RuntimeError(RuntimeError::Shadowing {
original_region,
shadow: shadow.clone(),
kind: ShadowKind::Variable,
}));
// let shadowed = Pattern2::Shadowed {
@ -443,6 +445,7 @@ pub fn to_pattern2<'a>(
env.problem(Problem::RuntimeError(RuntimeError::Shadowing {
original_region,
shadow: shadow.clone(),
kind: ShadowKind::Variable,
}));
// No matter what the other patterns