Skip to content

Ensure that param-array matching works correctly #1304

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

Merged
merged 3 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests for method matching in presence of param arrays
  • Loading branch information
filmor committed Dec 10, 2020
commit b9538b9566a3e86b706df3999ab2d4112a75e2ba
10 changes: 10 additions & 0 deletions src/testing/methodtest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,16 @@ public static string DefaultParamsWithOverloading(int a = 5, int b = 6, int c =
{
return $"{a}{b}{c}{d}XXX";
}

public static string ParamsArrayOverloaded(int i = 1)
{
return "without params-array";
}

public static string ParamsArrayOverloaded(int i, params int[] paramsArray)
{
return "with params-array";
}
}


Expand Down
34 changes: 34 additions & 0 deletions src/tests/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,3 +1188,37 @@ def test_keyword_arg_method_resolution():
ob = MethodArityTest()
assert ob.Foo(1, b=2) == "Arity 2"

def test_params_array_overload():
res = MethodTest.ParamsArrayOverloaded()
assert res == "without params-array"

res = MethodTest.ParamsArrayOverloaded(1)
assert res == "without params-array"

res = MethodTest.ParamsArrayOverloaded(i=1)
assert res == "without params-array"

res = MethodTest.ParamsArrayOverloaded(1, 2)
assert res == "with params-array"

res = MethodTest.ParamsArrayOverloaded(1, 2, 3)
assert res == "with params-array"

res = MethodTest.ParamsArrayOverloaded(1, 2, 3, i=1)
assert res == "with params-array"

# res = MethodTest.ParamsArrayOverloaded(paramsArray=[], i=1)
# assert res == "with params-array"

res = MethodTest.ParamsArrayOverloaded(1, paramsArray=[])
assert res == "with params-array"

res = MethodTest.ParamsArrayOverloaded(1, i=1)
assert res == "with params-array"

# res = MethodTest.ParamsArrayOverloaded(1, 2, i=1)
# assert res == "with params-array"

# res = MethodTest.ParamsArrayOverloaded(1, 2, 3, i=1)
# assert res == "with params-array"

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy