Update reporting tests

This commit is contained in:
Ayaz Hafiz 2022-07-18 13:35:50 -04:00
parent 96b32c36cb
commit 870294b564
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -8046,35 +8046,6 @@ All branches in an `if` must have the same type!
"###
);
test_report!(
ability_member_not_defined,
indoc!(
r#"
app "test" provides [] to "./platform"
Eq has
eq : a, a -> U64 | a has Eq
Hash has
hash : a, a -> U64 | a has Hash
A := U8 has [Eq {eq}, Hash {hash}]
"#
),
@r###"
NAMING ERROR tmp/ability_first_demand_not_indented_enough/Test.roc
I was partway through parsing an ability definition, but I got stuck
here:
4 Eq has
5 eq : a, a -> U64 | a has Eq
^
I suspect this line is not indented enough (by 1 spaces)
"###
);
test_report!(
wildcard_in_alias,
indoc!(
@ -9162,6 +9133,22 @@ All branches in an `if` must have the same type!
"#
);
test_report!(
#[ignore="TODO"]
opaque_ability_impl_not_found_shorthand_syntax,
indoc!(
r#"
app "test" provides [] to "./platform"
Eq has eq : a, a -> U64 | a has Eq
A := U8 has [Eq {eq}]
"#
),
@r###"
"###
);
test_report!(
opaque_ability_impl_not_found,
indoc!(
@ -9176,6 +9163,19 @@ All branches in an `if` must have the same type!
"#
),
@r###"
UNRECOGNIZED NAME /code/proj/Main.roc
Nothing is named `aEq` in this scope.
5 A := U8 has [ Eq {eq: aEq} ]
^^^
Did you mean one of these?
Eq
myEq
eq
U8
"###
);
@ -9183,7 +9183,7 @@ All branches in an `if` must have the same type!
opaque_ability_impl_optional,
indoc!(
r#"
app "test" provides [myEq] to "./platform"
app "test" provides [A, myEq] to "./platform"
Eq has eq : a, a -> Bool | a has Eq
@ -9193,6 +9193,16 @@ All branches in an `if` must have the same type!
"#
),
@r###"
OPTIONAL ABILITY IMPLEMENTATION /code/proj/Main.roc
Ability implementations cannot be optional:
5 A := U8 has [ Eq {eq ? aEq} ]
^^^^^^^^
Custom implementations must be supplied fully.
"###
);
@ -9210,6 +9220,18 @@ All branches in an `if` must have the same type!
"#
),
@r###"
OPTIONAL ABILITY IMPLEMENTATION /code/proj/Main.roc
Ability implementations cannot be optional:
5 A := U8 has [ Encoding {toEncoder ? myEncoder} ]
^^^^^^^^^^^^^^^^^^^^^
Custom implementations must be supplied fully.
Hint: if you want this implementation to be derived, don't include a
record of implementations. For example, has [Encoding] will attempt
to derive `Encoding`
"###
);
@ -9225,6 +9247,15 @@ All branches in an `if` must have the same type!
"#
),
@r###"
QUALIFIED ABILITY IMPLEMENTATION /code/proj/Main.roc
This ability implementation is qualified:
5 A := U8 has [ Eq {eq : Bool.eq} ]
^^^^^^^
Custom implementations must be defined in the local scope, and
unqualified.
"###
);
@ -9240,6 +9271,17 @@ All branches in an `if` must have the same type!
"#
),
@r###"
ABILITY IMPLEMENTATION NOT IDENTIFIER /code/proj/Main.roc
This ability implementation is not an identifier:
5 A := U8 has [ Eq {eq : \m, n -> m == n} ]
^^^^^^^^^^^^^^^
Custom ability implementations defined in this position can only be
unqualified identifiers, not arbitrary expressions.
Tip: consider defining this expression as a variable.
"###
);