Skip to content

xadd type signature is confusingly permissive #40

@wesrer

Description

@wesrer

Hi,

Sorry if this is a noob question, just been playing around with this shard, and I'm not sure why I'm encountering this error

  redis = Redis::Client.new

  test = {} of String => String
  test["name"] = "Homie"
  test["curr"] = "USD"
  redis.xadd "my-stream", "*", test.flat_map {|k, v| [k, v]}

It's throwing this error:

Showing last frame. Use --error-trace for full trace.

In /opt/homebrew/Cellar/crystal/1.7.2/share/crystal/src/pointer.cr:132:29

 132 | (self + offset).value = value
                               ^----
Error: type must be (Array(Redis::Value) | Int64 | String | Nil), not Array(String)

but Redis::Value is defined as:

 alias Value = String | Int64 | Nil | Array(Value)

Should this imply that Array(String) is a valid Redis::Value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions