@@ -19,7 +19,7 @@ object Errors:
19
19
def pos (using Context ): SourcePosition = trace.last.sourcePos
20
20
21
21
def issue (using Context ): Unit =
22
- report.warning(show + stacktrace() , this .pos)
22
+ report.warning(show, this .pos)
23
23
24
24
def stacktrace (preamble : String = " Calling trace:\n " )(using Context ): String = if trace.isEmpty then " " else preamble + {
25
25
var lastLineNum = - 1
@@ -72,43 +72,37 @@ object Errors:
72
72
case class AccessNonInit (field : Symbol , trace : Seq [Tree ]) extends Error :
73
73
def source : Tree = trace.last
74
74
def show (using Context ): String =
75
- " Access non-initialized " + field.show + " ."
75
+ " Access non-initialized " + field.show + " ." + stacktrace()
76
76
77
77
override def pos (using Context ): SourcePosition = field.sourcePos
78
78
79
79
/** Promote a value under initialization to fully-initialized */
80
80
case class PromoteError (msg : String , trace : Seq [Tree ]) extends Error :
81
- def show (using Context ): String = msg
81
+ def show (using Context ): String = msg + stacktrace()
82
82
83
83
case class AccessCold (field : Symbol , trace : Seq [Tree ]) extends Error :
84
84
def show (using Context ): String =
85
- " Access field on a value with an unknown initialization status."
85
+ " Access field on a value with an unknown initialization status." + stacktrace()
86
86
87
87
case class CallCold (meth : Symbol , trace : Seq [Tree ]) extends Error :
88
88
def show (using Context ): String =
89
- " Call method on a value with an unknown initialization" + " . "
89
+ " Call method on a value with an unknown initialization. " + stacktrace()
90
90
91
91
case class CallUnknown (meth : Symbol , trace : Seq [Tree ]) extends Error :
92
92
def show (using Context ): String =
93
93
val prefix = if meth.is(Flags .Method ) then " Calling the external method " else " Accessing the external field"
94
- prefix + meth.show + " may cause initialization errors" + " . "
94
+ prefix + meth.show + " may cause initialization errors. " + stacktrace()
95
95
96
96
/** Promote a value under initialization to fully-initialized */
97
97
case class UnsafePromotion (msg : String , trace : Seq [Tree ], error : Error ) extends Error :
98
- override def issue (using Context ): Unit =
99
- report.warning(show, this .pos)
100
-
101
98
def show (using Context ): String =
102
99
msg + stacktrace() + " \n " +
103
100
" Promoting the value to fully initialized failed due to the following problem:\n " +
104
- error.show + error.stacktrace()
101
+ error.show
105
102
106
103
/** Unsafe leaking a non-hot value as constructor arguments */
107
104
case class UnsafeLeaking (trace : Seq [Tree ], error : Error ) extends Error :
108
- override def issue (using Context ): Unit =
109
- report.warning(show, this .pos)
110
-
111
105
def show (using Context ): String =
112
- " Unsafe leaking of uninitialized value: the leaked value is used. " + stacktrace() + " \n " +
113
- " The leaked uninitialized value is used as follows :\n " +
114
- error.stacktrace(preamble = " " )
106
+ " Problematic object instantiation with uninitialized arguments. " + stacktrace() + " \n " +
107
+ " It leads to the following error during object initialization :\n " +
108
+ error.show
0 commit comments