Skip to content

Fix typeOf(nil) panic and give keys() a clear error on non-map values - #370

Merged
mattn merged 1 commit into
masterfrom
fix-core-typeof-nil
Jul 9, 2026
Merged

Fix typeOf(nil) panic and give keys() a clear error on non-map values#370
mattn merged 1 commit into
masterfrom
fix-core-typeof-nil

Conversation

@mattn

@mattn mattn commented Jul 9, 2026

Copy link
Copy Markdown
Owner

typeOf(nil) dereferenced the nil reflect.Type and panicked — an uncaught crash when running with Options.Debug. It now returns "nil", matching kindOf(nil).

keys() on a non-map leaked a raw reflect panic ("reflect: call of reflect.Value.MapKeys on int64 Value"); it now reports "keys expected map type, got int64".

Adds the first tests for the core package.

@mattn
mattn merged commit bb39d48 into master Jul 9, 2026
12 checks passed
@mattn
mattn deleted the fix-core-typeof-nil branch July 10, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant