mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-14 07:45:04 +00:00
add ingested file category for error messages
This commit is contained in:
parent
d42aa43b41
commit
7079361841
3 changed files with 8 additions and 13 deletions
|
@ -302,19 +302,7 @@ impl Expr {
|
||||||
Self::Int(..) => Category::Int,
|
Self::Int(..) => Category::Int,
|
||||||
Self::Float(..) => Category::Frac,
|
Self::Float(..) => Category::Frac,
|
||||||
Self::Str(..) => Category::Str,
|
Self::Str(..) => Category::Str,
|
||||||
Self::IngestedFile(_, anno) => {
|
Self::IngestedFile(..) => Category::IngestedFile,
|
||||||
dbg!(&anno);
|
|
||||||
todo!()
|
|
||||||
// if let Type::Apply(0, 1, 2) = anno.typ {
|
|
||||||
// Category::Str
|
|
||||||
// } else if let Type::Apply(_, _, _) = anno.typ {
|
|
||||||
// Category::List
|
|
||||||
// } else {
|
|
||||||
// todo!(
|
|
||||||
// "Not sure how we should handle other types here that are probably invalid"
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
Self::SingleQuote(..) => Category::Character,
|
Self::SingleQuote(..) => Category::Character,
|
||||||
Self::List { .. } => Category::List,
|
Self::List { .. } => Category::List,
|
||||||
&Self::Var(sym, _) => Category::Lookup(sym),
|
&Self::Var(sym, _) => Category::Lookup(sym),
|
||||||
|
|
|
@ -3781,6 +3781,7 @@ pub enum Category {
|
||||||
List,
|
List,
|
||||||
Str,
|
Str,
|
||||||
Character,
|
Character,
|
||||||
|
IngestedFile,
|
||||||
|
|
||||||
// records
|
// records
|
||||||
Record,
|
Record,
|
||||||
|
|
|
@ -1655,6 +1655,12 @@ fn format_category<'b>(
|
||||||
alloc.concat([this_is, alloc.text(" a Unicode scalar value")]),
|
alloc.concat([this_is, alloc.text(" a Unicode scalar value")]),
|
||||||
alloc.text(" of type:"),
|
alloc.text(" of type:"),
|
||||||
),
|
),
|
||||||
|
IngestedFile => (
|
||||||
|
// TODO: is this what we actually want for the error message here.
|
||||||
|
// Should we somehow get the file name piped to here or type annotation?
|
||||||
|
alloc.concat([this_is, alloc.text(" an ingested file")]),
|
||||||
|
alloc.text(" of type:"),
|
||||||
|
),
|
||||||
Lambda => (
|
Lambda => (
|
||||||
alloc.concat([this_is, alloc.text(" an anonymous function")]),
|
alloc.concat([this_is, alloc.text(" an anonymous function")]),
|
||||||
alloc.text(" of type:"),
|
alloc.text(" of type:"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue