Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uri.Path.Segment.equals throws a MatchError when passed a parameter of another type #6851

Closed
mattyjbrown opened this issue Dec 6, 2022 · 1 comment · Fixed by #6853
Closed

Comments

@mattyjbrown
Copy link
Contributor

mattyjbrown commented Dec 6, 2022

import org.http4s.Uri
Uri.Path.Segment.apply("123") == 123

result:

scala.MatchError: 123 (of class java.lang.Integer)
  at org.http4s.Uri$Path$Segment.equals(Uri.scala:468)

Missing a case _ => false:

  override def equals(obj: Any): Boolean =
    obj match {
      case s: Segment => s.encoded == encoded
    }

Other classes in Uri.scala have it, example:

  final class Scheme private[http4s] (val value: String) extends Ordered[Scheme] {
    override def equals(o: Any): Boolean =
      o match {
        case that: Scheme => this.value.equalsIgnoreCase(that.value)
        case _ => false
      }
@mattyjbrown
Copy link
Contributor Author

Proposed fix at #6853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants