Closed cjalmeida closed 3 years ago
Merging #35 (6a85a5e) into main (68ad1b7) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## main #35 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 202 234 +32
Branches 36 42 +6
=========================================
+ Hits 202 234 +32
Impacted Files | Coverage Δ | |
---|---|---|
multimethod/__init__.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 68ad1b7...6a85a5e. Read the comment docs.
Thanks. I'd like to try out the idea described in issue #36 first. Attempting to bind the arguments first handles the case of too many positional arguments.
Scenario giving dispatch error:
The equivalent Julia dispatch works as stated in the scenario above.
The actual fix changed the semantic of partial ordering in
signature.__le__
(line: 115); ie. not should never dispatch on a function withlen(signature_args) != len(call_positional_args)
. From Julia dev docs, this is the actual behavior of the dispatch logic.The side-effect was no longer handling
POSITIONAL_OR_KEYWORD
andVAR_POSITIONAL
properly. I added a bunch of tests to further stress the scenarios.I adapted
get_types
returning an iterable of signatures, eg. both(object, object)
and(object,)
when it encounters aPOSITIONAL_OR_KEYWORD
. This solution [mimics the Julia solution (https://docs.julialang.org/en/v1/manual/functions/#Optional-Arguments). For variadic positional args, the solution was to return a variadic argument marker, then expand the signature arguments, padding withobject
s as needed.Fixed tests for internal checks where needed.