improve opaque types tip

This commit is contained in:
Anton-4 2024-07-30 16:06:23 +02:00
parent 5b87d82b01
commit 30a76a092b
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
3 changed files with 16 additions and 27 deletions

View file

@ -1509,10 +1509,8 @@ mod cli_run {
Effect.Effect (Result {} []) Effect.Effect (Result {} [])
Tip: Type comparisons between an opaque type are only ever equal if Tip: Add type annotations to functions or values to help you figure
both types are the same opaque type. Did you mean to create an opaque this out.
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.

View file

@ -8240,10 +8240,8 @@ In roc, functions are always written as a lambda, like{}
F Str F Str
Tip: Type comparisons between an opaque type are only ever equal if Tip: *Add type annotations* to functions or values to help you figure
both types are the same opaque type. Did you mean to create an opaque this out.
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.
"# "#
); );
@ -8277,10 +8275,8 @@ In roc, functions are always written as a lambda, like{}
Age Age
Tip: Type comparisons between an opaque type are only ever equal if Tip: *Add type annotations* to functions or values to help you figure
both types are the same opaque type. Did you mean to create an opaque this out.
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.
" "
); );
@ -10403,10 +10399,8 @@ In roc, functions are always written as a lambda, like{}
OList OList
Tip: Type comparisons between an opaque type are only ever equal if Tip: *Add type annotations* to functions or values to help you figure
both types are the same opaque type. Did you mean to create an opaque this out.
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.
" "
); );

View file

@ -4761,17 +4761,14 @@ fn type_problem_to_pretty<'b>(
alloc.reflow("Learn more about optional fields at TODO."), alloc.reflow("Learn more about optional fields at TODO."),
])), ])),
(OpaqueComparedToNonOpaque, _) => alloc.tip().append(alloc.concat([ (OpaqueComparedToNonOpaque, _) => alloc.tip().append(
alloc.reflow( alloc.concat([
"Type comparisons between an opaque type are only ever \ alloc
equal if both types are the same opaque type. Did you mean \ .reflow("Add type annotations")
to create an opaque type by wrapping it? If I have an opaque type ", .annotate(Annotation::Emphasized),
alloc.reflow(" to functions or values to help you figure this out."),
]),
), ),
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("."),
])),
(BoolVsBoolTag(tag), _) => alloc.tip().append(alloc.concat([ (BoolVsBoolTag(tag), _) => alloc.tip().append(alloc.concat([
alloc.reflow("Did you mean to use "), alloc.reflow("Did you mean to use "),