@@ -22,51 +22,7 @@ import scala.util.matching.Regex.Match
2222
2323object FormatInterpolatorTransform :
2424 import tpd ._
25- import StringContextChecker .InterpolationReporter
2625
27- /*
28- /** This trait defines a tool to report errors/warnings that do not depend on Position. */
29- trait InterpolationReporter:
30-
31- /** Reports error/warning of size 1 linked with a part of the StringContext.
32- *
33- * @param message the message to report as error/warning
34- * @param index the index of the part inside the list of parts of the StringContext
35- * @param offset the index in the part String where the error is
36- * @return an error/warning depending on the function
37- */
38- def partError(message: String, index: Int, offset: Int): Unit
39- def partWarning(message: String, index: Int, offset: Int): Unit
40-
41- /** Reports error linked with an argument to format.
42- *
43- * @param message the message to report as error/warning
44- * @param index the index of the argument inside the list of arguments of the format function
45- * @return an error depending on the function
46- */
47- def argError(message: String, index: Int): Unit
48-
49- /** Reports error linked with the list of arguments or the StringContext.
50- *
51- * @param message the message to report in the error
52- * @return an error
53- */
54- def strCtxError(message: String): Unit
55- def argsError(message: String): Unit
56-
57- /** Claims whether an error or a warning has been reported
58- *
59- * @return true if an error/warning has been reported, false
60- */
61- def hasReported: Boolean
62-
63- /** Stores the old value of the reported and reset it to false */
64- def resetReported(): Unit
65-
66- /** Restores the value of the reported boolean that has been reset */
67- def restoreReported(): Unit
68- end InterpolationReporter
69- */
7026 class PartsReporter (fun : Tree , args0 : Tree , parts : List [Tree ], args : List [Tree ])(using Context ) extends InterpolationReporter :
7127 private var reported = false
7228 private var oldReported = false
@@ -193,3 +149,45 @@ object FormatInterpolatorTransform:
193149 (literally(checked.mkString), tpd.SeqLiteral (checker.actuals.toList, elemtpt))
194150 end checked
195151end FormatInterpolatorTransform
152+
153+ /** This trait defines a tool to report errors/warnings that do not depend on Position. */
154+ trait InterpolationReporter :
155+
156+ /** Reports error/warning of size 1 linked with a part of the StringContext.
157+ *
158+ * @param message the message to report as error/warning
159+ * @param index the index of the part inside the list of parts of the StringContext
160+ * @param offset the index in the part String where the error is
161+ * @return an error/warning depending on the function
162+ */
163+ def partError (message : String , index : Int , offset : Int ): Unit
164+ def partWarning (message : String , index : Int , offset : Int ): Unit
165+
166+ /** Reports error linked with an argument to format.
167+ *
168+ * @param message the message to report as error/warning
169+ * @param index the index of the argument inside the list of arguments of the format function
170+ * @return an error depending on the function
171+ */
172+ def argError (message : String , index : Int ): Unit
173+
174+ /** Reports error linked with the list of arguments or the StringContext.
175+ *
176+ * @param message the message to report in the error
177+ * @return an error
178+ */
179+ def strCtxError (message : String ): Unit
180+ def argsError (message : String ): Unit
181+
182+ /** Claims whether an error or a warning has been reported
183+ *
184+ * @return true if an error/warning has been reported, false
185+ */
186+ def hasReported : Boolean
187+
188+ /** Stores the old value of the reported and reset it to false */
189+ def resetReported (): Unit
190+
191+ /** Restores the value of the reported boolean that has been reset */
192+ def restoreReported (): Unit
193+ end InterpolationReporter
0 commit comments