Clojure

defprotocol: invalid method overload syntax getting accepted

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Approval:
    Vetted

Description

The compiler accepts both of these erroneous forms which while silly, are not imposible to come up with.

(defprotocol Foo (f ([this]) ([this arg])))
(defprotocol Bar (m [this]) (m [this arg]))

Activity

Hide
Timothy Baldridge added a comment -

Can not reproduce the fist error:

user=> (defprotocol Foo (f ([this]) ([this arg])))
CompilerException java.lang.IllegalArgumentException: Parameter declaration missing, compiling:(NO_SOURCE_PATH:5:1)

But the 2nd one I can reproduce:

user=> (defprotocol Bar (m [this]) (m [this arg]))
Bar
user=> Bar
{:on-interface user.Bar, :on user.Bar, :sigs {:m {:doc nil, :arglists ([this arg]), :name m}}, :var #'user/Bar, :method-map {:m :m}, :method-builders {#'user/m #<user$eval71$fn_72 user$eval71$fn_72@1a2b53fb>}}
user=>

Notice that :arglists only has one entry

Vetting

Show
Timothy Baldridge added a comment - Can not reproduce the fist error: user=> (defprotocol Foo (f ([this]) ([this arg]))) CompilerException java.lang.IllegalArgumentException: Parameter declaration missing, compiling:(NO_SOURCE_PATH:5:1) But the 2nd one I can reproduce: user=> (defprotocol Bar (m [this]) (m [this arg])) Bar user=> Bar {:on-interface user.Bar, :on user.Bar, :sigs {:m {:doc nil, :arglists ([this arg]), :name m}}, :var #'user/Bar, :method-map {:m :m}, :method-builders {#'user/m #<user$eval71$fn_72 user$eval71$fn_72@1a2b53fb>}} user=> Notice that :arglists only has one entry Vetting
Timothy Baldridge made changes -
Field Original Value New Value
Approval Vetted [ 10003 ]
Affects Version/s Release 1.5 [ 10150 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: