Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
typedFunction undoes eta-expansion regardless of expected type
When recovering missing argument types for an eta-expanded method value, rework the expected type to a method type.
- Loading branch information
Showing
3 changed files
with
41 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Test { | ||
def m(i: Int) = i | ||
|
||
def expectWild[A](f: A) = ??? | ||
def expectFun[A](f: A => Int) = ??? | ||
|
||
expectWild((i => m(i))) // manual eta expansion | ||
expectWild(m(_)) // have to undo eta expansion with wildcard expected type | ||
expectFun(m(_)) // have to undo eta expansion with function expected type | ||
} |