@@ -88,14 +88,21 @@ trait MessageRendering {
8888 * ```
8989 * | ^^^^^
9090 * ```
91+ * or for sub-diagnostics:
92+ * ```
93+ * | -----
94+ * ```
95+ *
96+ * @param pos the source position to mark
97+ * @param markerChar the character to use for marking ('^' for primary errors, '-' for notes)
9198 */
92- private def positionMarker (pos : SourcePosition )(using Context , Level , Offset ): String = {
99+ private def positionMarker (pos : SourcePosition , markerChar : Char = '^' )(using Context , Level , Offset ): String = {
93100 val padding = pos.startColumnPadding
94- val carets =
101+ val markers =
95102 if (pos.startLine == pos.endLine)
96- " ^ " * math.max(1 , pos.endColumn - pos.startColumn)
97- else " ^ "
98- hl(s " $offsetBox$padding$carets " )
103+ markerChar.toString * math.max(1 , pos.endColumn - pos.startColumn)
104+ else markerChar.toString
105+ hl(s " $offsetBox$padding$markers " )
99106 }
100107
101108 /** The horizontal line with the given offset
@@ -346,7 +353,9 @@ trait MessageRendering {
346353 .sortBy(pm => (pm.pos.startColumn, ! pm.isPrimary)) // Primary positions first if same column
347354
348355 for posAndMsg <- positionsOnLine do
349- val marker = positionMarker(posAndMsg.pos)
356+ // Use '^' for primary error, '-' for sub-diagnostics
357+ val markerChar = if posAndMsg.isPrimary then '^' else '-'
358+ val marker = positionMarker(posAndMsg.pos, markerChar)
350359 val err = errorMsg(posAndMsg.pos, posAndMsg.msg.message)
351360 sb.append(marker).append(EOL )
352361 sb.append(err).append(EOL )
@@ -449,7 +458,7 @@ trait MessageRendering {
449458
450459 val posString = posStr(pos1, msg, " Note" , isSubdiag = true )
451460 val (srcBefore, srcAfter, offset) = sourceLines(pos1)
452- val marker = positionMarker(pos1)
461+ val marker = positionMarker(pos1, '-' ) // Use '-' for sub-diagnostics
453462 val err = errorMsg(pos1, msg.message)
454463
455464 val diagText = (posString :: srcBefore ::: marker :: err :: srcAfter).mkString(EOL )
0 commit comments