Incorrect enum/constant comparison

Functional Logic & Control Flow

Last updated: November 10, 2025

Overview

Bug Type:
Incorrect enum/constant comparison
Category:
Functional Logic & Control Flow

Definition

Branches compare the wrong symbol/value or mix representations (e.g., string vs. numeric).

How to fix Incorrect enum/constant comparison?

Use strongly typed enums; avoid magic numbers; centralize mappings; add exhaustive switch checks and negative tests

Symptoms

Observable signs that may indicate Incorrect enum/constant comparison:

  • Switch/case fallbacks triggered unexpectedly.
  • Branching behaves differently across platforms/types.
  • Magic numbers used instead of enum symbols.

Example Errors:

  • Type mismatch in comparison
  • Case not handled for value
  • Assignment used where comparison intended

© 2025 peqy.ai · Bug Taxonomy