-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement
Description
Compiler version
3.7.4
Minimized example
def test[T](a: T) = collection.immutable.ArraySeq.fill(1)(a)
Output Error/Warning message
-- [E172] Type Error: -------------------------------------------------------------
1 |def test[T](a: T) = collection.immutable.ArraySeq.fill(1)(a)
| ^
| No ClassTag available for T
1 error found
Why this Error/Warning was not helpful
The message was unhelpful because it does not say precisely what to do to make it compile. If I have no clue about what a ClassTag is and why it's needed, then the message could be more helpful.
Suggested improvement
It could be made more helpful by showing an example of how to rewrite the type param with a context bound and include reflect.ClassTag so users do not stumble on "ClassTagf" not found in yet another error message, and not knowing in what package ClassTag resides.
For example:
-- [E172] Type Error: -------------------------------------------------------------
1 |def test[T](a: T) = collection.immutable.ArraySeq.fill(1)(a)
| ^
| No reflect.ClassTag available for T
| You can fix this by changing [T] to [T: reflect.ClassTag]
1 error found
Metadata
Metadata
Assignees
Labels
area:reportingError reporting including formatting, implicit suggestions, etcError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement