@@ -208,6 +208,31 @@ end Message
208
208
*
209
209
* @param errorId a unique id identifying the message, this will be
210
210
* used to reference documentation online
211
+ *
212
+ * Messages modify the rendendering of interpolated strings in several ways:
213
+ *
214
+ * 1. The size of the printed code is limited with a MessafeLimiter. If the message
215
+ * would get too large or too deeply nested, a `...` is printed instead.
216
+ * 2. References to module classes are prefixed with `object ` for better recogniability.
217
+ * 3. A where clause is sometimes added which contains the following additional explanations:
218
+ * - Rerences are disambiguated: If a message contains occurrences of the same identifier
219
+ * representing different symbols, the duplicates are printed with superscripts
220
+ * and the where-clause explains where each symbol is located.
221
+ * - Uninstantiated variables are explained in the where-clause with additional
222
+ * info about their bounds.
223
+ * - Skolems are explained with additional info about their underlying type.
224
+ *
225
+ * Messages inheriting from the NoDisambiguation trait or returned from the
226
+ * `noDisambiguation()` method skip point (3) above. This makes sense if the
227
+ * message already exolains where different occurrences of the same identifier
228
+ * are located. Examples are NamingMsgs such as double definition errors,
229
+ * overriding errors, and ambiguous implicit errors.
230
+ *
231
+ * We consciously made the design decision to disambiguate by default and disable
232
+ * disambiguation as an opt-in. The reason is that one usually does not consider all
233
+ * fine-grained details when writing an error message. If disambiguation is the default,
234
+ * some tests will show where clauses that look too noisy and that then can be disabled
235
+ * when needed. But
211
236
*/
212
237
abstract class Message (val errorId : ErrorMessageID )(using Context ) { self =>
213
238
import Message .*
0 commit comments