improved phantom type message

This commit is contained in:
Folkert 2020-04-14 21:27:29 +02:00
parent 7e4a1ef4bd
commit c42b5a1e5b
2 changed files with 10 additions and 2 deletions

View file

@ -425,7 +425,12 @@ pub fn can_problem<'b>(
alloc.reflow(" alias definition:"), alloc.reflow(" alias definition:"),
]), ]),
alloc.region(variable_region), alloc.region(variable_region),
alloc.reflow("Roc does not allow phantom type parameters!"), alloc.reflow("Roc does not allow unused type parameters!"),
// TODO add link to this guide section
alloc.hint().append(alloc.reflow(
"If you want an unused type parameter (a so-called \"phantom type\"), \
read the guide section on phantom data.",
)),
]), ]),
Problem::DuplicateRecordFieldValue { Problem::DuplicateRecordFieldValue {
field_name, field_name,

View file

@ -2663,7 +2663,10 @@ mod test_reporting {
1 Foo a : [ Foo ] 1 Foo a : [ Foo ]
^ ^
Roc does not allow phantom type parameters! Roc does not allow unused type parameters!
Hint: If you want an unused type parameter (a so-called "phantom
type"), read the guide section on phantom data.
"# "#
), ),
) )