@@ -19,7 +19,7 @@ object Errors:
1919 def pos (using Context ): SourcePosition = trace.last.sourcePos
2020
2121 def issue (using Context ): Unit =
22- report.warning(show + stacktrace() , this .pos)
22+ report.warning(show, this .pos)
2323
2424 def stacktrace (preamble : String = " Calling trace:\n " )(using Context ): String = if trace.isEmpty then " " else preamble + {
2525 var lastLineNum = - 1
@@ -72,43 +72,37 @@ object Errors:
7272 case class AccessNonInit (field : Symbol , trace : Seq [Tree ]) extends Error :
7373 def source : Tree = trace.last
7474 def show (using Context ): String =
75- " Access non-initialized " + field.show + " ."
75+ " Access non-initialized " + field.show + " ." + stacktrace()
7676
7777 override def pos (using Context ): SourcePosition = field.sourcePos
7878
7979 /** Promote a value under initialization to fully-initialized */
8080 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()
8282
8383 case class AccessCold (field : Symbol , trace : Seq [Tree ]) extends Error :
8484 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()
8686
8787 case class CallCold (meth : Symbol , trace : Seq [Tree ]) extends Error :
8888 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()
9090
9191 case class CallUnknown (meth : Symbol , trace : Seq [Tree ]) extends Error :
9292 def show (using Context ): String =
9393 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()
9595
9696 /** Promote a value under initialization to fully-initialized */
9797 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-
10198 def show (using Context ): String =
10299 msg + stacktrace() + " \n " +
103100 " Promoting the value to fully initialized failed due to the following problem:\n " +
104- error.show + error.stacktrace()
101+ error.show
105102
106103 /** Unsafe leaking a non-hot value as constructor arguments */
107104 case class UnsafeLeaking (trace : Seq [Tree ], error : Error ) extends Error :
108- override def issue (using Context ): Unit =
109- report.warning(show, this .pos)
110-
111105 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