Objo.
Feedback Forum Docs Objo Studio
Feedback

Bug #1325

Dictionary numeric keys can compare equal but hash differently

Status
Fixed
Fixed in
v26.8.6
Source discussion
-
Last updated
2026-08-29

Upvotes

0 upvotes

Uses your Objo forum account.

Public summary

Dictionary keys that are numerically equal are treated as different keys depending on their type. 1 and 1.0 are equal under normal Objo numeric equality, but they receive different hashes, so a dictionary can hold two entries for the same logical key — one reachable only with 1 and one only with 1.0.

Var d As New Dictionary
d.Value(1) = "a"
Print(d.HasKey(1.0)) # False — even though 1 = 1.0
d.Value(1.0) = "b"   # Adds a second entry instead of updating the first
Print(d.Count)       # 2

Numerically equal Integer and Double keys should identify the same entry, consistent with normal Objo numeric equality and with HashSet, which already unifies numeric hashes. Expected behaviour:

  • 1 and 1.0, 0 and 0.0, and negative equivalents such as -2 and -2.0 are one key.
  • Insertion, Count, indexing, HasKey, Lookup, Value, and Remove treat them as one entry.
  • Equal keys always produce equal hashes.
  • Case-insensitive (default) and case-sensitive string key behaviour is unchanged; case sensitivity continues to affect only strings.

Objo.

Build apps visually, deploy anywhere.

Feedback is a public read-only status mirror for Objo Studio.