@@ -26,6 +26,7 @@ import ast.untpd
26
26
import ast .tpd
27
27
import transform .SymUtils ._
28
28
import cc .CaptureSet .IdentityCaptRefMap
29
+ import language .experimental .pureFunctions
29
30
30
31
/** Messages
31
32
* ========
@@ -41,45 +42,56 @@ import cc.CaptureSet.IdentityCaptRefMap
41
42
*/
42
43
43
44
abstract class SyntaxMsg (errorId : ErrorMessageID ) extends Message (errorId):
45
+ this : SyntaxMsg =>
44
46
def kind = MessageKind .Syntax
45
47
46
48
abstract class TypeMsg (errorId : ErrorMessageID ) extends Message (errorId):
49
+ this : TypeMsg =>
47
50
def kind = MessageKind .Type
48
51
49
52
trait ShowMatchTrace (tps : Type * )(using Context ) extends Message :
53
+ this : ShowMatchTrace =>
50
54
override def msgSuffix : String = matchReductionAddendum(tps* )
51
55
52
56
abstract class TypeMismatchMsg (found : Type , expected : Type )(errorId : ErrorMessageID )(using Context )
53
57
extends Message (errorId), ShowMatchTrace (found, expected):
58
+ this : TypeMismatchMsg =>
54
59
def kind = MessageKind .TypeMismatch
55
60
def explain = err.whyNoMatchStr(found, expected)
56
61
override def canExplain = true
57
62
58
63
abstract class NamingMsg (errorId : ErrorMessageID ) extends Message (errorId):
64
+ this : NamingMsg =>
59
65
def kind = MessageKind .Naming
60
66
61
67
abstract class DeclarationMsg (errorId : ErrorMessageID ) extends Message (errorId):
68
+ this : DeclarationMsg =>
62
69
def kind = MessageKind .Declaration
63
70
64
71
/** A simple not found message (either for idents, or member selection.
65
72
* Messages of this class are sometimes dropped in favor of other, more
66
73
* specific messages.
67
74
*/
68
75
abstract class NotFoundMsg (errorId : ErrorMessageID ) extends Message (errorId):
76
+ this : NotFoundMsg =>
69
77
def kind = MessageKind .NotFound
70
78
def name : Name
71
79
72
80
abstract class PatternMatchMsg (errorId : ErrorMessageID ) extends Message (errorId):
81
+ this : PatternMatchMsg =>
73
82
def kind = MessageKind .PatternMatch
74
83
75
84
abstract class CyclicMsg (errorId : ErrorMessageID ) extends Message (errorId):
85
+ this : CyclicMsg =>
76
86
def kind = MessageKind .Cyclic
77
87
78
88
abstract class ReferenceMsg (errorId : ErrorMessageID ) extends Message (errorId):
89
+ this : ReferenceMsg =>
79
90
def kind = MessageKind .Reference
80
91
81
92
abstract class EmptyCatchOrFinallyBlock (tryBody : untpd.Tree , errNo : ErrorMessageID )(using Context )
82
93
extends SyntaxMsg (errNo) {
94
+ this : EmptyCatchOrFinallyBlock =>
83
95
def explain = {
84
96
val tryString = tryBody match {
85
97
case Block (Nil , untpd.EmptyTree ) => " {}"
@@ -242,7 +254,7 @@ import cc.CaptureSet.IdentityCaptRefMap
242
254
}
243
255
}
244
256
245
- class TypeMismatch (found : Type , expected : Type , inTree : Option [untpd.Tree ], addenda : = > String * )(using Context )
257
+ class TypeMismatch (found : Type , expected : Type , inTree : Option [untpd.Tree ], addenda : - > String * )(using Context )
246
258
extends TypeMismatchMsg (found, expected)(TypeMismatchID ):
247
259
248
260
// replace constrained TypeParamRefs and their typevars by their bounds where possible
@@ -298,7 +310,7 @@ import cc.CaptureSet.IdentityCaptRefMap
298
310
299
311
end TypeMismatch
300
312
301
- class NotAMember (site : Type , val name : Name , selected : String , addendum : = > String = " " )(using Context )
313
+ class NotAMember (site : Type , val name : Name , selected : String , addendum : - > String = " " )(using Context )
302
314
extends NotFoundMsg (NotAMemberID ), ShowMatchTrace (site) {
303
315
// println(i"site = $site, decls = ${site.decls}, source = ${site.typeSymbol.sourceFile}") //DEBUG
304
316
@@ -822,7 +834,7 @@ import cc.CaptureSet.IdentityCaptRefMap
822
834
|Write `.to $targetType` instead. """ .stripMargin
823
835
def explain = " "
824
836
825
- class PatternMatchExhaustivity (uncoveredFn : = > String , hasMore : Boolean )(using Context )
837
+ class PatternMatchExhaustivity (uncoveredFn : - > String , hasMore : Boolean )(using Context )
826
838
extends Message (PatternMatchExhaustivityID ) {
827
839
def kind = MessageKind .PatternMatchExhaustivity
828
840
lazy val uncovered = uncoveredFn
@@ -842,7 +854,7 @@ import cc.CaptureSet.IdentityCaptRefMap
842
854
| """
843
855
}
844
856
845
- class UncheckedTypePattern (msgFn : = > String )(using Context )
857
+ class UncheckedTypePattern (msgFn : - > String )(using Context )
846
858
extends PatternMatchMsg (UncheckedTypePatternID ) {
847
859
def msg = msgFn
848
860
def explain =
@@ -1972,7 +1984,7 @@ import cc.CaptureSet.IdentityCaptRefMap
1972
1984
}
1973
1985
}
1974
1986
1975
- class CyclicInheritance (symbol : Symbol , addendum : = > String )(using Context ) extends SyntaxMsg (CyclicInheritanceID ) {
1987
+ class CyclicInheritance (symbol : Symbol , addendum : - > String )(using Context ) extends SyntaxMsg (CyclicInheritanceID ) {
1976
1988
def msg = em " Cyclic inheritance: $symbol extends itself $addendum"
1977
1989
def explain = {
1978
1990
val codeExample = " class A extends A"
0 commit comments