-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #11185: cache pretyped argument with adaptation in FunProto #12171
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Test: | ||
def foo(a: Int, b: Int) = a + b | ||
|
||
Map(1 -> 2).map(foo _) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a random thought, but if the collections ever get rewritten again, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I'll add another test with overloading. |
||
Map(1 -> 2).map(foo) | ||
|
||
class Test2: | ||
def foo(a: Int, b: Int) = a + b | ||
|
||
def bar(f: ((Int, Int)) => Int) = "ok" | ||
def bar(f: ((Int, Int)) => String)(using Int) = "ok" | ||
|
||
bar(foo) | ||
bar(foo _) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance this looks too simplistic. We do a complicated dance not to overcommit by caching arguments that can be passed to several different expected types. How can we be sure that we can simply cache in this case? Maybe we can, but we'd need a detailed comment why.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a comment is deserved here. Currently I see the rationale is this: the
expected type
for pretyping here come from all the overloading candidates and they (commandParamTypes
) are all fully defined.I rebased against master, it seems to work.