8000 A map with values of different types passes the checker · Issue #771 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

A map with values of different types passes the checker #771

Open

Description

@akoskovacs

A list rejects mixed element types (KEXET-0438), but a map literal with mixed value types is accepted, and so is put with a value of another type.

main do
  let ages = { "ada": 36, "bob": "old" }
  IO.printLine(ages)

  let more = { "ada": 36 }.put("bob", "old")
  IO.printLine(more)
end

kex -C says No errors found., and both backends print { ada: 36, bob: old } twice.

Expected: the literal rejected as a list would be, and put rejected for a String value on a Map<String, Integer>. Otherwise code that reads ages.get("bob") as an Integer? gets a String.

Seen on kex 0.4.0-rc.4 built from main at 371bbdf, and on 5773911. Found while writing explanations for oops.kex.run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0