Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix(core): false-positive from #1682 (#1692)

Elijah Potterf2fd7c8bdee5
diff --git a/harper-core/src/linting/pronoun_inflection_be.rs b/harper-core/src/linting/pronoun_inflection_be.rs
index 189a993c6..5e4dd9e1d 100644
--- a/harper-core/src/linting/pronoun_inflection_be.rs
+++ b/harper-core/src/linting/pronoun_inflection_be.rs
@@ -51,6 +51,14 @@ impl PronounInflectionBe {
map.insert(arent, "isn't");
let is = SequenceExpr::default()
+ .then(|tok: &Token, _: &[char]| {
+ tok.kind
+ .as_word()
+ .as_ref()
+ .and_then(|m| m.as_ref().and_then(|m| m.np_member))
+ .unwrap_or_default()
+ })
+ .then_whitespace()
.then_third_person_plural_pronoun()
.then_optional(mod_term.clone())
.t_ws()
@@ -59,6 +67,16 @@ impl PronounInflectionBe {
.t_any();
map.insert(is, "are");
+ let is_at_start = SequenceExpr::default()
+ .then(AnchorStart)
+ .then_third_person_plural_pronoun()
+ .then_optional(mod_term.clone())
+ .t_ws()
+ .t_aco("is")
+ .t_any()
+ .t_any();
+ map.insert(is_at_start, "are");
+
let isnt = SequenceExpr::default()
.then_third_person_plural_pronoun()
.then_optional(mod_term.clone())
@@ -406,4 +424,12 @@ mod tests {
PronounInflectionBe::default(),
);
}
+
+ #[test]
+ fn issue_1682() {
+ assert_no_lints(
+ "Understanding them is significant",
+ PronounInflectionBe::default(),
+ );
+ }
}
diff --git a/harper-core/tests/text/linters/this and that.snap.yml b/harper-core/tests/text/linters/this and that.snap.yml
index c04683ae0..e69de29bb 100644
--- a/harper-core/tests/text/linters/this and that.snap.yml
+++ b/harper-core/tests/text/linters/this and that.snap.yml
@@ -1,9 +0,0 @@
-Lint: Agreement (30 priority)
-Message: |
- 2 | As such, disambiguating them is necessary.
- | ^~ Make the verb agree with its subject.
-Suggest:
- - Replace with: “are”
-
-
-