mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Address @rtfeldman review
This commit is contained in:
parent
07b1829732
commit
34900c1f55
5 changed files with 15 additions and 15 deletions
|
@ -187,7 +187,7 @@ pub enum Expr {
|
||||||
// Id n := [ Id U64 n ]
|
// Id n := [ Id U64 n ]
|
||||||
// @Id "sasha"
|
// @Id "sasha"
|
||||||
//
|
//
|
||||||
// Then `name` is "Id", `argument` is "sasha", but this is not enough for us to
|
// Then `opaque` is "Id", `argument` is "sasha", but this is not enough for us to
|
||||||
// infer the type of the expression as "Id Str" - we need to link the specialized type of
|
// infer the type of the expression as "Id Str" - we need to link the specialized type of
|
||||||
// the variable "n".
|
// the variable "n".
|
||||||
// That's what `specialized_def_type` and `type_arguments` are for; they are specialized
|
// That's what `specialized_def_type` and `type_arguments` are for; they are specialized
|
||||||
|
|
|
@ -40,7 +40,7 @@ pub enum Pattern {
|
||||||
//
|
//
|
||||||
// f = \@Id who -> strToBool who
|
// f = \@Id who -> strToBool who
|
||||||
//
|
//
|
||||||
// Then `name` is "Id", `argument` is "who", but this is not enough for us to
|
// Then `opaque` is "Id", `argument` is "who", but this is not enough for us to
|
||||||
// infer the type of the expression as "Id Str" - we need to link the specialized type of
|
// infer the type of the expression as "Id Str" - we need to link the specialized type of
|
||||||
// the variable "n".
|
// the variable "n".
|
||||||
// That's what `specialized_def_type` and `type_arguments` are for; they are specialized
|
// That's what `specialized_def_type` and `type_arguments` are for; they are specialized
|
||||||
|
|
|
@ -755,7 +755,7 @@ mod test_load {
|
||||||
err,
|
err,
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
── OPAQUE DECLARED OUTSIDE SCOPE ───────────────────────────────────────────────
|
── OPAQUE TYPE DECLARED OUTSIDE SCOPE ───────────────────────────────────────────────
|
||||||
|
|
||||||
The unwrapped opaque type Age referenced here:
|
The unwrapped opaque type Age referenced here:
|
||||||
|
|
||||||
|
@ -769,7 +769,7 @@ mod test_load {
|
||||||
|
|
||||||
Note: Opaque types can only be wrapped and unwrapped in the module they are defined in!
|
Note: Opaque types can only be wrapped and unwrapped in the module they are defined in!
|
||||||
|
|
||||||
── OPAQUE DECLARED OUTSIDE SCOPE ───────────────────────────────────────────────
|
── OPAQUE TYPE DECLARED OUTSIDE SCOPE ───────────────────────────────────────────────
|
||||||
|
|
||||||
The unwrapped opaque type Age referenced here:
|
The unwrapped opaque type Age referenced here:
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ const NESTED_DATATYPE: &str = "NESTED DATATYPE";
|
||||||
const CONFLICTING_NUMBER_SUFFIX: &str = "CONFLICTING NUMBER SUFFIX";
|
const CONFLICTING_NUMBER_SUFFIX: &str = "CONFLICTING NUMBER SUFFIX";
|
||||||
const NUMBER_OVERFLOWS_SUFFIX: &str = "NUMBER OVERFLOWS SUFFIX";
|
const NUMBER_OVERFLOWS_SUFFIX: &str = "NUMBER OVERFLOWS SUFFIX";
|
||||||
const NUMBER_UNDERFLOWS_SUFFIX: &str = "NUMBER UNDERFLOWS SUFFIX";
|
const NUMBER_UNDERFLOWS_SUFFIX: &str = "NUMBER UNDERFLOWS SUFFIX";
|
||||||
const OPAQUE_NOT_DEFINED: &str = "OPAQUE NOT DEFINED";
|
const OPAQUE_NOT_DEFINED: &str = "OPAQUE TYPE NOT DEFINED";
|
||||||
const OPAQUE_DECLARED_OUTSIDE_SCOPE: &str = "OPAQUE DECLARED OUTSIDE SCOPE";
|
const OPAQUE_DECLARED_OUTSIDE_SCOPE: &str = "OPAQUE TYPE DECLARED OUTSIDE SCOPE";
|
||||||
const OPAQUE_NOT_APPLIED: &str = "OPAQUE NOT APPLIED";
|
const OPAQUE_NOT_APPLIED: &str = "OPAQUE TYPE NOT APPLIED";
|
||||||
const OPAQUE_OVER_APPLIED: &str = "OPAQUE APPLIED TO TOO MANY ARGS";
|
const OPAQUE_OVER_APPLIED: &str = "OPAQUE TYPE APPLIED TO TOO MANY ARGS";
|
||||||
|
|
||||||
pub fn can_problem<'b>(
|
pub fn can_problem<'b>(
|
||||||
alloc: &'b RocDocAllocator<'b>,
|
alloc: &'b RocDocAllocator<'b>,
|
||||||
|
@ -1451,7 +1451,7 @@ fn pretty_runtime_error<'b>(
|
||||||
}
|
}
|
||||||
RuntimeError::OpaqueNotApplied(loc_ident) => {
|
RuntimeError::OpaqueNotApplied(loc_ident) => {
|
||||||
doc = alloc.stack(vec![
|
doc = alloc.stack(vec![
|
||||||
alloc.reflow("This opaque is not applied to an argument:"),
|
alloc.reflow("This opaque type is not applied to an argument:"),
|
||||||
alloc.region(lines.convert_region(loc_ident.region)),
|
alloc.region(lines.convert_region(loc_ident.region)),
|
||||||
alloc.note("Opaque types always wrap exactly one argument!"),
|
alloc.note("Opaque types always wrap exactly one argument!"),
|
||||||
]);
|
]);
|
||||||
|
@ -1460,7 +1460,7 @@ fn pretty_runtime_error<'b>(
|
||||||
}
|
}
|
||||||
RuntimeError::OpaqueAppliedToMultipleArgs(region) => {
|
RuntimeError::OpaqueAppliedToMultipleArgs(region) => {
|
||||||
doc = alloc.stack(vec![
|
doc = alloc.stack(vec![
|
||||||
alloc.reflow("This opaque is applied to multiple arguments:"),
|
alloc.reflow("This opaque type is applied to multiple arguments:"),
|
||||||
alloc.region(lines.convert_region(region)),
|
alloc.region(lines.convert_region(region)),
|
||||||
alloc.note("Opaque types always wrap exactly one argument!"),
|
alloc.note("Opaque types always wrap exactly one argument!"),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -8147,7 +8147,7 @@ I need all branches in an `if` to have the same type!
|
||||||
),
|
),
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
── OPAQUE NOT DEFINED ──────────────────────────────────────────────────────────
|
── OPAQUE TYPE NOT DEFINED ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
The opaque type Age referenced here is not defined:
|
The opaque type Age referenced here is not defined:
|
||||||
|
|
||||||
|
@ -8172,7 +8172,7 @@ I need all branches in an `if` to have the same type!
|
||||||
),
|
),
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
── OPAQUE NOT DEFINED ──────────────────────────────────────────────────────────
|
── OPAQUE TYPE NOT DEFINED ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
The opaque type Age referenced here is not defined:
|
The opaque type Age referenced here is not defined:
|
||||||
|
|
||||||
|
@ -8213,9 +8213,9 @@ I need all branches in an `if` to have the same type!
|
||||||
// Apply(Error(OtherModule), [ $Age, 21 ])
|
// Apply(Error(OtherModule), [ $Age, 21 ])
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
── OPAQUE NOT APPLIED ──────────────────────────────────────────────────────────
|
── OPAQUE TYPE NOT APPLIED ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
This opaque is not applied to an argument:
|
This opaque type is not applied to an argument:
|
||||||
|
|
||||||
1│ OtherModule.$Age 21
|
1│ OtherModule.$Age 21
|
||||||
^^^^
|
^^^^
|
||||||
|
@ -8263,7 +8263,7 @@ I need all branches in an `if` to have the same type!
|
||||||
If you didn't intend on using `Age` then remove it so future readers of
|
If you didn't intend on using `Age` then remove it so future readers of
|
||||||
your code don't wonder why it is there.
|
your code don't wonder why it is there.
|
||||||
|
|
||||||
── OPAQUE NOT DEFINED ──────────────────────────────────────────────────────────
|
── OPAQUE TYPE NOT DEFINED ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
The opaque type Age referenced here is not defined:
|
The opaque type Age referenced here is not defined:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue