Skip to content

docs: explain map literal key types - #998

Open
ViktorBystrov72 wants to merge 1 commit into
expr-lang:masterfrom
ViktorBystrov72:docs/map-literal-keys
Open

ViktorBystrov72 wants to merge 1 commit into
expr-lang:masterfrom
ViktorBystrov72:docs/map-literal-keys

Conversation

@ViktorBystrov72

Copy link
Copy Markdown

Document that map literals create map[string]any, including conversion of numeric keys to strings. Show string-key lookup and membership examples, and distinguish literals from Go maps supplied through the environment, which retain their declared key types.

Closes #862. Documentation only.

Validation:

  • Reproduced both reported integer-key errors and exercised the documented literal and map[int]string forms.
  • go test ./checker -run '^TestCheck($|_error$|_operator_in_works_with_interfaces$)' -count=1
  • go test . -run '^(TestExpr_map_|TestCompile_allow_to_use_interface_to_get_an_element_from_map|TestExpr_env_types_map|TestIssue758_filter_map_index|ExampleEnv$)' -count=1
  • git diff --check

Signed-off-by: Виктор Быстров <anatema@bk.ru>

This branch has not been deployed

No deployments
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.

Unexpected map key type conversion

1 participant