8000 Receiver call silently misdispatches to another type same-named method · Issue #620 · kexhq/kex · GitHub
[go: up one dir, main page]

Skip to content

Receiver call silently misdispatches to another type same-named method #620

Open

Description

@akoskovacs

With this in src/stdlib/net/socket.kex (file level, inside module Net.Socket):

make TCP.TCPConnection do
  foul getLine -> Result<String?, NetError> do
    match TCP.receiveLine(this, 65536) do
      Ok(bytes) => Ok(bytes.to(String))
      Error(e) => e.kind == Closed then Ok(None) else Error(e)
    end
  end
end

a loopback probe calling conn.getLine (conn: TCPConnection) does NOT call it: it dispatches to FileHandle.getLine and fails with {kex_try_error,'ReadFailed'} (ReadFailed is a file error). -C is clean; the checker picks the wrong method.

Same root as the Client.get note in spec/net_http_roundtrip_beam.kex (make-block methods of a using-imported module are not in the receiver-function interface), but silent: instead of erroring, the call runs another type's method. Found while adding filehandle-style getLine/printLine to TCP; worked around with bare first-arg functions, which dispatch correctly.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0