Skip to content

Commit 1be4b80

Browse files
committed
Change messages.scala to work with cc
1 parent 97ce7c2 commit 1be4b80

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/pos-with-compiler-cc/dotc/reporting/messages.scala

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,45 +41,56 @@ import cc.CaptureSet.IdentityCaptRefMap
4141
*/
4242

4343
abstract class SyntaxMsg(errorId: ErrorMessageID) extends Message(errorId):
44+
this: SyntaxMsg =>
4445
def kind = MessageKind.Syntax
4546

4647
abstract class TypeMsg(errorId: ErrorMessageID) extends Message(errorId):
48+
this: TypeMsg =>
4749
def kind = MessageKind.Type
4850

4951
trait ShowMatchTrace(tps: Type*)(using Context) extends Message:
52+
this: ShowMatchTrace =>
5053
override def msgSuffix: String = matchReductionAddendum(tps*)
5154

5255
abstract class TypeMismatchMsg(found: Type, expected: Type)(errorId: ErrorMessageID)(using Context)
5356
extends Message(errorId), ShowMatchTrace(found, expected):
57+
this: TypeMismatchMsg =>
5458
def kind = MessageKind.TypeMismatch
5559
def explain = err.whyNoMatchStr(found, expected)
5660
override def canExplain = true
5761

5862
abstract class NamingMsg(errorId: ErrorMessageID) extends Message(errorId):
63+
this: NamingMsg =>
5964
def kind = MessageKind.Naming
6065

6166
abstract class DeclarationMsg(errorId: ErrorMessageID) extends Message(errorId):
67+
this: DeclarationMsg =>
6268
def kind = MessageKind.Declaration
6369

6470
/** A simple not found message (either for idents, or member selection.
6571
* Messages of this class are sometimes dropped in favor of other, more
6672
* specific messages.
6773
*/
6874
abstract class NotFoundMsg(errorId: ErrorMessageID) extends Message(errorId):
75+
this: NotFoundMsg =>
6976
def kind = MessageKind.NotFound
7077
def name: Name
7178

7279
abstract class PatternMatchMsg(errorId: ErrorMessageID) extends Message(errorId):
80+
this: PatternMatchMsg =>
7381
def kind = MessageKind.PatternMatch
7482

7583
abstract class CyclicMsg(errorId: ErrorMessageID) extends Message(errorId):
84+
this: CyclicMsg =>
7685
def kind = MessageKind.Cyclic
7786

7887
abstract class ReferenceMsg(errorId: ErrorMessageID) extends Message(errorId):
88+
this: ReferenceMsg =>
7989
def kind = MessageKind.Reference
8090

8191
abstract class EmptyCatchOrFinallyBlock(tryBody: untpd.Tree, errNo: ErrorMessageID)(using Context)
8292
extends SyntaxMsg(errNo) {
93+
this: EmptyCatchOrFinallyBlock =>
8394
def explain = {
8495
val tryString = tryBody match {
8596
case Block(Nil, untpd.EmptyTree) => "{}"
@@ -242,7 +253,7 @@ import cc.CaptureSet.IdentityCaptRefMap
242253
}
243254
}
244255

245-
class TypeMismatch(found: Type, expected: Type, inTree: Option[untpd.Tree], addenda: => String*)(using Context)
256+
class TypeMismatch(found: Type, expected: Type, inTree: Option[untpd.Tree], addenda: -> String*)(using Context)
246257
extends TypeMismatchMsg(found, expected)(TypeMismatchID):
247258

248259
// replace constrained TypeParamRefs and their typevars by their bounds where possible
@@ -298,7 +309,7 @@ import cc.CaptureSet.IdentityCaptRefMap
298309

299310
end TypeMismatch
300311

301-
class NotAMember(site: Type, val name: Name, selected: String, addendum: => String = "")(using Context)
312+
class NotAMember(site: Type, val name: Name, selected: String, addendum: -> String = "")(using Context)
302313
extends NotFoundMsg(NotAMemberID), ShowMatchTrace(site) {
303314
//println(i"site = $site, decls = ${site.decls}, source = ${site.typeSymbol.sourceFile}") //DEBUG
304315

@@ -822,7 +833,7 @@ import cc.CaptureSet.IdentityCaptRefMap
822833
|Write `.to$targetType` instead.""".stripMargin
823834
def explain = ""
824835

825-
class PatternMatchExhaustivity(uncoveredFn: => String, hasMore: Boolean)(using Context)
836+
class PatternMatchExhaustivity(uncoveredFn: -> String, hasMore: Boolean)(using Context)
826837
extends Message(PatternMatchExhaustivityID) {
827838
def kind = MessageKind.PatternMatchExhaustivity
828839
lazy val uncovered = uncoveredFn
@@ -842,7 +853,7 @@ import cc.CaptureSet.IdentityCaptRefMap
842853
|"""
843854
}
844855

845-
class UncheckedTypePattern(msgFn: => String)(using Context)
856+
class UncheckedTypePattern(msgFn: -> String)(using Context)
846857
extends PatternMatchMsg(UncheckedTypePatternID) {
847858
def msg = msgFn
848859
def explain =
@@ -1972,7 +1983,7 @@ import cc.CaptureSet.IdentityCaptRefMap
19721983
}
19731984
}
19741985

1975-
class CyclicInheritance(symbol: Symbol, addendum: => String)(using Context) extends SyntaxMsg(CyclicInheritanceID) {
1986+
class CyclicInheritance(symbol: Symbol, addendum: -> String)(using Context) extends SyntaxMsg(CyclicInheritanceID) {
19761987
def msg = em"Cyclic inheritance: $symbol extends itself$addendum"
19771988
def explain = {
19781989
val codeExample = "class A extends A"

0 commit comments

Comments
 (0)