Skip to content

Lookups broken for typos with 2.8.1 #75

Closed as not planned
Closed as not planned
@epage

Description

@epage

Note: I'm still working on a root cause (whether with my code, unicase, or phf) but wanted to communicate this early

I've narrowed down the failure in crate-ci/typos#1202 to the unicase 2.8.0 to 2.8.1 upgrade.

  ---- dict::test::test_dict_to_varcon stdout ----
  thread 'dict::test::test_dict_to_varcon' panicked at crates/typos-cli/src/dict.rs:379:9:
  assertion `left == right` failed
    left: None
   right: Some(Corrections(["finalises"]))

The test is

    #[cfg(feature = "dict")]
    #[test]
    fn test_dict_correct() {
        let dict = BuiltIn::new(crate::config::Locale::default());
        let correction = dict.correct_word(typos::tokens::Word::new_unchecked(
            "finallizes",
            Case::Lower,
            0,
        ));
        assert_eq!(
            correction,
            Some(Status::Corrections(vec!["finalizes".into()]))
        );
    }

This is looking up finallizes in a PHF Map. I use wrapper types (InsensitiveStr and InsensitiveAscii) to avoid calling a const fn on thousands of items which can dramatically slow down compilation times. These delegate to unicase::UniCase and unicase::Ascii which I believe are supposed to hash to the same thing for the same input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions