Skip to content

Commit

Permalink
backport for #226
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Apr 8, 2024
1 parent e56215f commit d302775
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,9 @@ private [parsley] final class EmptyErrorWithReason(val presentationOffset: Int,
}

private [errors] final class TrivialMergedErrors private [errors] (val err1: TrivialDefuncError, val err2: TrivialDefuncError) extends TrivialDefuncError {
override final val flags = err1.flags & err2.flags
// FIXME: this is horrid, split out the flags at this point, we'll do 16-bit and 8-bit
override final val flags = scala.math.max(err1.entrenchedBy, err2.entrenchedBy) |
(err1.flags & err2.flags & ~DefuncError.EntrenchedMask)
assume(err1.underlyingOffset == err2.underlyingOffset, "two errors only merge when they have matching offsets")
override val underlyingOffset = err1.underlyingOffset
assume(err1.presentationOffset == err2.presentationOffset, "two errors only merge when they have matching offsets")
Expand All @@ -369,7 +371,9 @@ private [errors] final class TrivialMergedErrors private [errors] (val err1: Tri
}

private [errors] final class FancyMergedErrors private [errors] (val err1: FancyDefuncError, val err2: FancyDefuncError) extends FancyDefuncError {
override final val flags = err1.flags & err2.flags
// FIXME: this is horrid, split out the flags at this point, we'll do 16-bit and 8-bit
override final val flags = scala.math.max(err1.entrenchedBy, err2.entrenchedBy) |
(err1.flags & err2.flags & ~DefuncError.EntrenchedMask)
assume(err1.underlyingOffset == err2.underlyingOffset, "two errors only merge when they have matching offsets")
override val underlyingOffset = err1.underlyingOffset
assume(err1.presentationOffset == err2.presentationOffset, "two errors only merge when they have matching offsets")
Expand Down

0 comments on commit d302775

Please sign in to comment.