From 34900c1f558366929b58b02f3674b5d7ed8c8e35 Mon Sep 17 00:00:00 2001 From: ayazhafiz Date: Sat, 26 Feb 2022 14:24:04 -0500 Subject: [PATCH] Address @rtfeldman review --- compiler/can/src/expr.rs | 2 +- compiler/can/src/pattern.rs | 2 +- compiler/load/tests/test_load.rs | 4 ++-- reporting/src/error/canonicalize.rs | 12 ++++++------ reporting/tests/test_reporting.rs | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/can/src/expr.rs b/compiler/can/src/expr.rs index 51d904660b..dc672693ff 100644 --- a/compiler/can/src/expr.rs +++ b/compiler/can/src/expr.rs @@ -187,7 +187,7 @@ pub enum Expr { // Id n := [ Id U64 n ] // @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 // the variable "n". // That's what `specialized_def_type` and `type_arguments` are for; they are specialized diff --git a/compiler/can/src/pattern.rs b/compiler/can/src/pattern.rs index a94fcbab0e..549fe0d51a 100644 --- a/compiler/can/src/pattern.rs +++ b/compiler/can/src/pattern.rs @@ -40,7 +40,7 @@ pub enum Pattern { // // 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 // the variable "n". // That's what `specialized_def_type` and `type_arguments` are for; they are specialized diff --git a/compiler/load/tests/test_load.rs b/compiler/load/tests/test_load.rs index 894954d4dc..08a392a49c 100644 --- a/compiler/load/tests/test_load.rs +++ b/compiler/load/tests/test_load.rs @@ -755,7 +755,7 @@ mod test_load { err, indoc!( r#" - ── OPAQUE DECLARED OUTSIDE SCOPE ─────────────────────────────────────────────── + ── OPAQUE TYPE DECLARED OUTSIDE SCOPE ─────────────────────────────────────────────── 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! - ── OPAQUE DECLARED OUTSIDE SCOPE ─────────────────────────────────────────────── + ── OPAQUE TYPE DECLARED OUTSIDE SCOPE ─────────────────────────────────────────────── The unwrapped opaque type Age referenced here: diff --git a/reporting/src/error/canonicalize.rs b/reporting/src/error/canonicalize.rs index 1091a80b79..ab009aba3e 100644 --- a/reporting/src/error/canonicalize.rs +++ b/reporting/src/error/canonicalize.rs @@ -29,10 +29,10 @@ const NESTED_DATATYPE: &str = "NESTED DATATYPE"; const CONFLICTING_NUMBER_SUFFIX: &str = "CONFLICTING NUMBER SUFFIX"; const NUMBER_OVERFLOWS_SUFFIX: &str = "NUMBER OVERFLOWS SUFFIX"; const NUMBER_UNDERFLOWS_SUFFIX: &str = "NUMBER UNDERFLOWS SUFFIX"; -const OPAQUE_NOT_DEFINED: &str = "OPAQUE NOT DEFINED"; -const OPAQUE_DECLARED_OUTSIDE_SCOPE: &str = "OPAQUE DECLARED OUTSIDE SCOPE"; -const OPAQUE_NOT_APPLIED: &str = "OPAQUE NOT APPLIED"; -const OPAQUE_OVER_APPLIED: &str = "OPAQUE APPLIED TO TOO MANY ARGS"; +const OPAQUE_NOT_DEFINED: &str = "OPAQUE TYPE NOT DEFINED"; +const OPAQUE_DECLARED_OUTSIDE_SCOPE: &str = "OPAQUE TYPE DECLARED OUTSIDE SCOPE"; +const OPAQUE_NOT_APPLIED: &str = "OPAQUE TYPE NOT APPLIED"; +const OPAQUE_OVER_APPLIED: &str = "OPAQUE TYPE APPLIED TO TOO MANY ARGS"; pub fn can_problem<'b>( alloc: &'b RocDocAllocator<'b>, @@ -1451,7 +1451,7 @@ fn pretty_runtime_error<'b>( } RuntimeError::OpaqueNotApplied(loc_ident) => { 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.note("Opaque types always wrap exactly one argument!"), ]); @@ -1460,7 +1460,7 @@ fn pretty_runtime_error<'b>( } RuntimeError::OpaqueAppliedToMultipleArgs(region) => { 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.note("Opaque types always wrap exactly one argument!"), ]); diff --git a/reporting/tests/test_reporting.rs b/reporting/tests/test_reporting.rs index dfef4f0d61..50ee6c004e 100644 --- a/reporting/tests/test_reporting.rs +++ b/reporting/tests/test_reporting.rs @@ -8147,7 +8147,7 @@ I need all branches in an `if` to have the same type! ), indoc!( r#" - ── OPAQUE NOT DEFINED ────────────────────────────────────────────────────────── + ── OPAQUE TYPE 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!( r#" - ── OPAQUE NOT DEFINED ────────────────────────────────────────────────────────── + ── OPAQUE TYPE 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 ]) indoc!( 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 ^^^^ @@ -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 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: