From 42bc74d4bacd179e374719eb42b343147e861a69 Mon Sep 17 00:00:00 2001 From: BrettMayson Date: Sat, 19 Oct 2024 09:11:49 -0600 Subject: [PATCH] improve imvalid_comparisons --- hls/package-lock.json | 5 +++++ hls/package.json | 1 + .../src/analyze/lints/s21_invalid_comparisons.rs | 15 +++------------ .../lints/s21_invalid_comparisons/source.sqf | 1 + 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hls/package-lock.json b/hls/package-lock.json index 9bc4bcf1..feaadf2f 100644 --- a/hls/package-lock.json +++ b/hls/package-lock.json @@ -9,6 +9,7 @@ "version": "0.2.15", "license": "MIT", "dependencies": { + "hemtt": "file:", "portfinder": "^1.0.32", "vscode-languageclient": "^9.0.1" }, @@ -2249,6 +2250,10 @@ "he": "bin/he" } }, + "node_modules/hemtt": { + "resolved": "", + "link": true + }, "node_modules/http-proxy-agent": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", diff --git a/hls/package.json b/hls/package.json index 43bb9d6a..81434a86 100644 --- a/hls/package.json +++ b/hls/package.json @@ -154,6 +154,7 @@ "vscode-uri": "^3.0.8" }, "dependencies": { + "hemtt": "file:", "portfinder": "^1.0.32", "vscode-languageclient": "^9.0.1" } diff --git a/libs/sqf/src/analyze/lints/s21_invalid_comparisons.rs b/libs/sqf/src/analyze/lints/s21_invalid_comparisons.rs index f718f1ae..63ddf365 100644 --- a/libs/sqf/src/analyze/lints/s21_invalid_comparisons.rs +++ b/libs/sqf/src/analyze/lints/s21_invalid_comparisons.rs @@ -345,15 +345,10 @@ fn check_issue(a: &Comparison, b: &Comparison) -> Option { span_b: b_span, }) } else { - Some(ComparisonIssue { - issue: ComparisonIssueType::Impossible, - span_a: a_span, - span_b: b_span, - }) + None } } - (Comparison::NotEqual(_, num_a, _), Comparison::Equal(_, num_b, _)) - | (Comparison::Equal(_, num_a, _), Comparison::NotEqual(_, num_b, _)) => { + (Comparison::NotEqual(_, num_a, _), Comparison::Equal(_, num_b, _)) => { if num_a == num_b { Some(ComparisonIssue { issue: ComparisonIssueType::Impossible, @@ -361,11 +356,7 @@ fn check_issue(a: &Comparison, b: &Comparison) -> Option { span_b: b_span, }) } else { - Some(ComparisonIssue { - issue: ComparisonIssueType::Overlapping, - span_a: a_span, - span_b: b_span, - }) + None } } _ => None, diff --git a/libs/sqf/tests/lints/s21_invalid_comparisons/source.sqf b/libs/sqf/tests/lints/s21_invalid_comparisons/source.sqf index c9ff8ecf..2847414a 100644 --- a/libs/sqf/tests/lints/s21_invalid_comparisons/source.sqf +++ b/libs/sqf/tests/lints/s21_invalid_comparisons/source.sqf @@ -16,3 +16,4 @@ if (_x < 20 && _x < 10) then { systemChat "This is wasteful"; }; +if (_key != 1 && _key != 2 && _key != 3) exitWith {false};