Skip to content

Commit e4a32e3

Browse files
committed
Update phrasing for NotClassType explain error message
Fixes #14175
1 parent 5850d2d commit e4a32e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: compiler/src/dotty/tools/dotc/reporting/messages.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,11 @@ extends SyntaxMsg(TargetNameOnTopLevelClassID):
27752775
class NotClassType(tp: Type)(using Context)
27762776
extends TypeMsg(NotClassTypeID), ShowMatchTrace(tp):
27772777
def msg(using Context) = i"$tp is not a class type"
2778-
def explain(using Context) = ""
2778+
def explain(using Context) =
2779+
i"""A class type includes classes and traits in a specific order. Defining a class, even an anonymous class,
2780+
|requires specifying an order for the traits it extends. For example, `A & B` is not a class type because it
2781+
|doesn't specify which trait takes precedence, A or B. Both `A with B` and `B with A` are class types.
2782+
|Class types also can't have refinements."""
27792783

27802784
class NotConstant(suffix: String, tp: Type)(using Context)
27812785
extends TypeMsg(NotConstantID), ShowMatchTrace(tp):

0 commit comments

Comments
 (0)