File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -993,20 +993,22 @@ object Parsers {
993
993
else {
994
994
val saved = placeholderParams
995
995
placeholderParams = Nil
996
+
997
+ def wrapPlaceholders (t : Tree ) = try
998
+ if (placeholderParams.isEmpty) t
999
+ else new WildcardFunction (placeholderParams.reverse, t)
1000
+ finally placeholderParams = saved
1001
+
996
1002
val t = expr1(location)
997
1003
if (in.token == ARROW ) {
998
- placeholderParams = saved
999
- closureRest(start, location, convertToParams(t))
1004
+ placeholderParams = Nil // don't interpret `_' to the left of `=>` as placeholder
1005
+ wrapPlaceholders( closureRest(start, location, convertToParams(t) ))
1000
1006
}
1001
1007
else if (isWildcard(t)) {
1002
1008
placeholderParams = placeholderParams ::: saved
1003
1009
t
1004
1010
}
1005
- else
1006
- try
1007
- if (placeholderParams.isEmpty) t
1008
- else new WildcardFunction (placeholderParams.reverse, t)
1009
- finally placeholderParams = saved
1011
+ else wrapPlaceholders(t)
1010
1012
}
1011
1013
}
1012
1014
Original file line number Diff line number Diff line change
1
+ object Test {
2
+
3
+ trait Gen [T ] {
4
+ def map [U ](f : T => U ): Gen [U ] = ???
5
+ }
6
+
7
+ def f [T ](implicit g : Gen [T ]): Gen [() => T ] =
8
+ g map ( () => _ )
9
+ }
You can’t perform that action at this time.
0 commit comments