ocaml.lang.correctness.physical-vs-structural.physical-equal

Author
169
Download Count*
License
You probably want the structural equality operator =
Run Locally
Run in CI
Defintion
rules:
- id: physical-equal
pattern: $X == $Y
message: You probably want the structural equality operator =
languages:
- ocaml
severity: WARNING
metadata:
category: correctness
technology:
- ocaml
references:
- https://v2.ocaml.org/api/Stdlib.html#1_Comparisons
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
Examples
physical-vs-structural.ml
let test xs ys =
(* ruleid:physical-not-equal *)
if xs != ys
then 1
else 2
let test2 xs ys =
(* ruleid:physical-equal *)
if xs == ys
then 1
else 2
Short Link: https://sg.run/EOZN