+26
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__different_records_0_redundant_comparison.snap
+26
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__different_records_0_redundant_comparison.snap
···
1
+
---
2
+
source: compiler-core/src/type_/tests/warnings.rs
3
+
assertion_line: 4131
4
+
expression: "\npub type Either {\n Left\n Right\n}\n\npub fn main() -> Bool {\n Left == Right\n}\n"
5
+
snapshot_kind: text
6
+
---
7
+
----- SOURCE CODE
8
+
9
+
pub type Either {
10
+
Left
11
+
Right
12
+
}
13
+
14
+
pub fn main() -> Bool {
15
+
Left == Right
16
+
}
17
+
18
+
19
+
----- WARNING
20
+
warning: Redundant comparison
21
+
┌─ /src/warning/wrn.gleam:8:3
22
+
│
23
+
8 │ Left == Right
24
+
│ ^^^^^^^^^^^^^ This is always `False`
25
+
26
+
This comparison is redundant since it always fails.
+48
compiler-core/src/type_/tests/warnings.rs
+48
compiler-core/src/type_/tests/warnings.rs
···
4125
4125
"
4126
4126
);
4127
4127
}
4128
+
4129
+
#[test]
4130
+
fn different_records_0_redundant_comparison() {
4131
+
assert_warning!(
4132
+
"
4133
+
pub type Either {
4134
+
Left
4135
+
Right
4136
+
}
4137
+
4138
+
pub fn main() -> Bool {
4139
+
Left == Right
4140
+
}
4141
+
"
4142
+
);
4143
+
}
4144
+
4145
+
#[test]
4146
+
fn different_records_1_redundant_comparison() {
4147
+
assert_warning!(
4148
+
"
4149
+
pub type Either {
4150
+
Left(Int)
4151
+
Right
4152
+
}
4153
+
4154
+
pub fn main() -> Bool {
4155
+
Left(1) == Right
4156
+
}
4157
+
"
4158
+
);
4159
+
}
4160
+
4161
+
#[test]
4162
+
fn different_records_2_redundant_comparison() {
4163
+
assert_warning!(
4164
+
"
4165
+
pub type Either {
4166
+
Left(Int)
4167
+
Right(Int)
4168
+
}
4169
+
4170
+
pub fn main() -> Bool {
4171
+
Left(1) == Right(1)
4172
+
}
4173
+
"
4174
+
);
4175
+
}