Skip to content

Commit

Permalink
Renamed msg"" to m""
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jul 1, 2024
1 parent 0d96392 commit 04fea18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/core/time.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object Clock:
enum Weekday:
case Mon, Tue, Wed, Thu, Fri, Sat, Sun

case class DateError(text: Text) extends Error(msg"the value $text is not a valid date")
case class DateError(text: Text) extends Error(m"the value $text is not a valid date")

object Dates:
opaque type Date = Int
Expand Down Expand Up @@ -547,27 +547,27 @@ object Aviation:
val hour = d.toInt
val minutes = ((d - hour) * 100 + 0.5).toInt

if minutes >= 60 then abandon(msg"a time cannot have a minute value above 59", lit.pos)
if hour < 0 then abandon(msg"a time cannot be negative", lit.pos)
if hour > 12 then abandon(msg"a time cannot have an hour value above 12", lit.pos)
if minutes >= 60 then abandon(m"a time cannot have a minute value above 59", lit.pos)
if hour < 0 then abandon(m"a time cannot be negative", lit.pos)
if hour > 12 then abandon(m"a time cannot have an hour value above 12", lit.pos)

val h: Base24 = (hour + (if pm then 12 else 0)).asInstanceOf[Base24]
val length = lit.pos.endColumn - lit.pos.startColumn

if (hour < 10 && length != 4) || (hour >= 10 && length != 5)
then abandon(msg"the time should have exactly two minutes digits", lit.pos)
then abandon(m"the time should have exactly two minutes digits", lit.pos)

val m: Base60 = minutes.asInstanceOf[Base60]
'{Time(${Expr[Base24](h)}, ${Expr[Base60](m)}, 0)}

case _ =>
abandon(msg"expected a literal double value")
abandon(m"expected a literal double value")

@capability
case class Timezone private(name: Text)

case class TimezoneError(name: Text)
extends Error(msg"the name $name does not refer to a known timezone")
extends Error(m"the name $name does not refer to a known timezone")

object LocalTime:
given (using RomanCalendar) => LocalTime is GenericInstant as generic =
Expand Down
18 changes: 9 additions & 9 deletions src/core/timezone.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import scala.io.*

object TzdbError:
given Reason is Communicable =
case Reason.CouldNotParseTime(time) => msg"could not parse time $time"
case Reason.UnexpectedRule => msg"unexpected rule"
case Reason.UnexpectedLink => msg"unexpected link"
case Reason.UnexpectedZoneInfo => msg"unexpected zone info"
case Reason.BadZoneInfo(line) => msg"bad zone information: ${line.join(t"[", t" ", t"]")}"
case Reason.BadName(name) => msg"the name $name is not valid"
case Reason.UnparsableDate => msg"the date could not be parsed"
case Reason.ZoneFileMissing(name) => msg"the zone file $name could not be found on the classpath"
case Reason.CouldNotParseTime(time) => m"could not parse time $time"
case Reason.UnexpectedRule => m"unexpected rule"
case Reason.UnexpectedLink => m"unexpected link"
case Reason.UnexpectedZoneInfo => m"unexpected zone info"
case Reason.BadZoneInfo(line) => m"bad zone information: ${line.join(t"[", t" ", t"]")}"
case Reason.BadName(name) => m"the name $name is not valid"
case Reason.UnparsableDate => m"the date could not be parsed"
case Reason.ZoneFileMissing(name) => m"the zone file $name could not be found on the classpath"

enum Reason:
case CouldNotParseTime(time: Text)
Expand All @@ -51,7 +51,7 @@ object TzdbError:
case ZoneFileMissing(name: Text)

case class TzdbError(reason: TzdbError.Reason, line: Int)
extends Error(msg"the timezone could not be parsed at line $line: $reason")
extends Error(m"the timezone could not be parsed at line $line: $reason")

object Tzdb:
case class Time(hours: Int, minutes: Int, seconds: Int, suffix: Optional[Char])
Expand Down

0 comments on commit 04fea18

Please sign in to comment.