mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Miscellaneous cleanup
This commit is contained in:
parent
1b38cd0504
commit
28c3709ddf
6 changed files with 7 additions and 33 deletions
|
@ -1064,7 +1064,7 @@ fn canonicalize_has_clause(
|
|||
let shadow = Loc::at(region, var_name_ident);
|
||||
env.problem(roc_problem::can::Problem::Shadowing {
|
||||
original_region: shadowing.first_seen(),
|
||||
shadow: shadow.clone(),
|
||||
shadow,
|
||||
kind: ShadowKind::Variable,
|
||||
});
|
||||
return Err(Type::Error);
|
||||
|
|
|
@ -162,8 +162,6 @@ impl FunctionLayout {
|
|||
subs: &Subs,
|
||||
flat_type: &FlatType,
|
||||
) -> Result<Self, LayoutError> {
|
||||
use LayoutError::*;
|
||||
|
||||
match flat_type {
|
||||
FlatType::Func(arguments, lambda_set, result) => {
|
||||
let slice = Slice::reserve(layouts, arguments.len() + 1);
|
||||
|
@ -740,8 +738,6 @@ impl Layout {
|
|||
subs: &Subs,
|
||||
flat_type: &FlatType,
|
||||
) -> Result<Layout, LayoutError> {
|
||||
use LayoutError::*;
|
||||
|
||||
match flat_type {
|
||||
FlatType::Apply(Symbol::LIST_LIST, arguments) => {
|
||||
debug_assert_eq!(arguments.len(), 1);
|
||||
|
|
|
@ -29,8 +29,8 @@ use roc_region::all::Loc;
|
|||
use roc_solve_problem::TypeError;
|
||||
use roc_types::subs::{
|
||||
self, AliasVariables, Content, Descriptor, FlatType, GetSubsSlice, LambdaSet, Mark,
|
||||
OptVariable, Rank, RecordFields, Subs, SubsIndex, SubsSlice, UlsOfVar, UnionLabels,
|
||||
UnionLambdas, UnionTags, Variable, VariableSubsSlice,
|
||||
OptVariable, Rank, RecordFields, Subs, SubsSlice, UlsOfVar, UnionLabels, UnionLambdas,
|
||||
UnionTags, Variable, VariableSubsSlice,
|
||||
};
|
||||
use roc_types::types::{
|
||||
gather_fields_unsorted_iter, AliasKind, AliasShared, Category, OptAbleVar, Polarity, Reason,
|
||||
|
@ -2928,7 +2928,7 @@ fn type_to_variable<'a>(
|
|||
|
||||
result
|
||||
}
|
||||
Erroneous => {
|
||||
Error => {
|
||||
let content = Content::Error;
|
||||
|
||||
register_with_known_var(subs, destination, rank, pools, content)
|
||||
|
|
|
@ -10,7 +10,6 @@ use crate::types::{
|
|||
use roc_collections::all::MutMap;
|
||||
use roc_module::ident::{Lowercase, TagName};
|
||||
use roc_module::symbol::{Interns, ModuleId, Symbol};
|
||||
use std::fmt::Write;
|
||||
|
||||
pub static WILDCARD: &str = "*";
|
||||
static EMPTY_RECORD: &str = "{}";
|
||||
|
|
|
@ -8,7 +8,7 @@ use roc_collections::soa::{Index, Slice};
|
|||
use roc_collections::VecMap;
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_module::called_via::CalledVia;
|
||||
use roc_module::ident::{ForeignSymbol, Ident, Lowercase, TagName};
|
||||
use roc_module::ident::{ForeignSymbol, Lowercase, TagName};
|
||||
use roc_module::low_level::LowLevel;
|
||||
use roc_module::symbol::{Interns, Symbol};
|
||||
use roc_region::all::{Loc, Region};
|
||||
|
|
|
@ -6,9 +6,9 @@ use roc_collections::VecMap;
|
|||
use roc_error_macros::internal_error;
|
||||
use roc_exhaustive::{CtorName, ListArity};
|
||||
use roc_module::called_via::{BinOp, CalledVia};
|
||||
use roc_module::ident::{Ident, IdentStr, Lowercase, TagName};
|
||||
use roc_module::ident::{IdentStr, Lowercase, TagName};
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_region::all::{LineInfo, Loc, Region};
|
||||
use roc_region::all::{LineInfo, Region};
|
||||
use roc_solve_problem::{
|
||||
NotDerivableContext, NotDerivableDecode, NotDerivableEq, TypeError, UnderivableReason,
|
||||
Unfulfilled,
|
||||
|
@ -22,7 +22,6 @@ use roc_types::types::{
|
|||
use std::path::PathBuf;
|
||||
use ven_pretty::DocAllocator;
|
||||
|
||||
const DUPLICATE_NAME: &str = "DUPLICATE NAME";
|
||||
const ADD_ANNOTATIONS: &str = r#"Can more type annotations be added? Type annotations always help me give more specific messages, and I think they could help a lot in this case"#;
|
||||
|
||||
const OPAQUE_NUM_SYMBOLS: &[Symbol] = &[
|
||||
|
@ -395,26 +394,6 @@ fn underivable_hint<'b>(
|
|||
}
|
||||
}
|
||||
|
||||
fn report_shadowing<'b>(
|
||||
alloc: &'b RocDocAllocator<'b>,
|
||||
lines: &LineInfo,
|
||||
original_region: Region,
|
||||
shadow: Loc<Ident>,
|
||||
) -> RocDocBuilder<'b> {
|
||||
let line = r#"Since these types have the same name, it's easy to use the wrong one on accident. Give one of them a new name."#;
|
||||
|
||||
alloc.stack([
|
||||
alloc
|
||||
.text("The ")
|
||||
.append(alloc.ident(shadow.value))
|
||||
.append(alloc.reflow(" name is first defined here:")),
|
||||
alloc.region(lines.convert_region(original_region)),
|
||||
alloc.reflow("But then it's defined a second time here:"),
|
||||
alloc.region(lines.convert_region(shadow.region)),
|
||||
alloc.reflow(line),
|
||||
])
|
||||
}
|
||||
|
||||
pub fn cyclic_alias<'b>(
|
||||
alloc: &'b RocDocAllocator<'b>,
|
||||
lines: &LineInfo,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue