Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with protocol methods in record where later arg overrides "this" #557

Closed
borkdude opened this issue Apr 8, 2021 · 0 comments
Closed

Comments

@borkdude
Copy link
Collaborator

borkdude commented Apr 8, 2021

(defprotocol SomeProtocol
  (some-protocol-method [impl arg]))

(defrecord ConstantUnderscore [constant-val]
  SomeProtocol
  (some-protocol-method [_ _]
    constant-val))

(defrecord ConstantNamed [constant-val]
  SomeProtocol
  (some-protocol-method [_ v]
    constant-val))

(def underscore (->ConstantUnderscore :foo))

(prn (some-protocol-method underscore :bar)) ;; => nil, should be :foo

(def named (->ConstantNamed :foo))

(prn (some-protocol-method named :bar)) ;; => :foo
@borkdude borkdude changed the title Bug with protocol methods with same named args Bug with protocol methods in record where later arg overrides "this" Apr 8, 2021
@borkdude borkdude closed this as completed Apr 8, 2021
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

No branches or pull requests

1 participant