All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dotty.tools.dotc.reporting.HideNonSensicalMessages.scala Maven / Gradle / Ivy

There is a newer version: 3.6.4-RC1-bin-20241220-0bfa1af-NIGHTLY
Show newest version
package dotty.tools
package dotc
package reporting

import core.Contexts.*

/**
 * This trait implements `isHidden` so that we avoid reporting non-sensical messages.
 */
trait HideNonSensicalMessages extends Reporter {
  /** Hides non-sensical messages, unless we haven't reported any error yet or
   *  `-Yshow-suppressed-errors` is set.
   */
  override def isHidden(dia: Diagnostic)(using Context): Boolean =
    super.isHidden(dia) || {
        hasErrors  // if there are no errors yet, report even if diagnostic is non-sensical
        && dia.msg.isNonSensical // defer forcing the message by calling hasErrors first
        && !ctx.settings.YshowSuppressedErrors.value
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy