From d55938e6371cef883c8d9a52ecdf2087da6ab2e4 Mon Sep 17 00:00:00 2001 From: aherlihy Date: Tue, 6 Feb 2024 18:14:23 +0100 Subject: [PATCH] Update phrasing for NotClassType explain error message Fixes #14175 --- compiler/src/dotty/tools/dotc/reporting/messages.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index c230e3b4d6d7..890c3e91bf3a 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -2775,7 +2775,10 @@ extends SyntaxMsg(TargetNameOnTopLevelClassID): class NotClassType(tp: Type)(using Context) extends TypeMsg(NotClassTypeID), ShowMatchTrace(tp): def msg(using Context) = i"$tp is not a class type" - def explain(using Context) = "" + def explain(using Context) = + i"""A class type includes classes and traits in a specific order. Defining a class, even an anonymous class, + |requires specifying an order for the traits it extends. For example, `A & B` is not a class type because it + |doesn't specify which trait takes precedence, A or B. Both `A with B` and `B with A` are class types.""" class NotConstant(suffix: String, tp: Type)(using Context) extends TypeMsg(NotConstantID), ShowMatchTrace(tp):