mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
Merge pull request #6941 from roc-lang/improve-tip
improve opaque types tip
This commit is contained in:
commit
d23426ac47
3 changed files with 16 additions and 27 deletions
|
@ -1484,10 +1484,8 @@ mod cli_run {
|
|||
|
||||
Effect.Effect (Result {} [])
|
||||
|
||||
Tip: Type comparisons between an opaque type are only ever equal if
|
||||
both types are the same opaque type. Did you mean to create an opaque
|
||||
type by wrapping it? If I have an opaque type Age := U32 I can create
|
||||
an instance of this opaque type by doing @Age 23.
|
||||
Tip: Add type annotations to functions or values to help you figure
|
||||
this out.
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
@ -8257,10 +8257,8 @@ All branches in an `if` must have the same type!
|
|||
|
||||
F Str
|
||||
|
||||
Tip: Type comparisons between an opaque type are only ever equal if
|
||||
both types are the same opaque type. Did you mean to create an opaque
|
||||
type by wrapping it? If I have an opaque type Age := U32 I can create
|
||||
an instance of this opaque type by doing @Age 23.
|
||||
Tip: *Add type annotations* to functions or values to help you figure
|
||||
this out.
|
||||
"#
|
||||
);
|
||||
|
||||
|
@ -8294,10 +8292,8 @@ All branches in an `if` must have the same type!
|
|||
|
||||
Age
|
||||
|
||||
Tip: Type comparisons between an opaque type are only ever equal if
|
||||
both types are the same opaque type. Did you mean to create an opaque
|
||||
type by wrapping it? If I have an opaque type Age := U32 I can create
|
||||
an instance of this opaque type by doing @Age 23.
|
||||
Tip: *Add type annotations* to functions or values to help you figure
|
||||
this out.
|
||||
"
|
||||
);
|
||||
|
||||
|
@ -10420,10 +10416,8 @@ All branches in an `if` must have the same type!
|
|||
|
||||
OList
|
||||
|
||||
Tip: Type comparisons between an opaque type are only ever equal if
|
||||
both types are the same opaque type. Did you mean to create an opaque
|
||||
type by wrapping it? If I have an opaque type Age := U32 I can create
|
||||
an instance of this opaque type by doing @Age 23.
|
||||
Tip: *Add type annotations* to functions or values to help you figure
|
||||
this out.
|
||||
"
|
||||
);
|
||||
|
||||
|
|
|
@ -4788,17 +4788,14 @@ fn type_problem_to_pretty<'b>(
|
|||
alloc.reflow("Learn more about optional fields at TODO."),
|
||||
])),
|
||||
|
||||
(OpaqueComparedToNonOpaque, _) => alloc.tip().append(alloc.concat([
|
||||
alloc.reflow(
|
||||
"Type comparisons between an opaque type are only ever \
|
||||
equal if both types are the same opaque type. Did you mean \
|
||||
to create an opaque type by wrapping it? If I have an opaque type ",
|
||||
),
|
||||
alloc.type_str("Age := U32"),
|
||||
alloc.reflow(" I can create an instance of this opaque type by doing "),
|
||||
alloc.type_str("@Age 23"),
|
||||
alloc.reflow("."),
|
||||
])),
|
||||
(OpaqueComparedToNonOpaque, _) => alloc.tip().append(
|
||||
alloc.concat([
|
||||
alloc
|
||||
.reflow("Add type annotations")
|
||||
.annotate(Annotation::Emphasized),
|
||||
alloc.reflow(" to functions or values to help you figure this out."),
|
||||
]),
|
||||
),
|
||||
|
||||
(BoolVsBoolTag(tag), _) => alloc.tip().append(alloc.concat([
|
||||
alloc.reflow("Did you mean to use "),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue